Showing posts with label SharePoint Lists. Show all posts
Showing posts with label SharePoint Lists. Show all posts

22 August 2010

Neat Tool for Getting GUIDs and Attribute Names

This utility is very handy for SharePoint development in order to extract the GUID of a List and other attributes.

If you type in the URL of a Site, then press Display List Titles and IDs, you will get a list of Lists within that site. You can then select (highlight) the GUID of the List you require, do a right-click with your mouse and then select Set List GUID. This will copy the GUID into the text-box called List ID (as shown below).

Show List and View GUIDs
Select the GUID of your List and Right-Click to reveal further options
Once the List GUID is copied to the List ID text-box field, you can press the Display Views button to display all the available list views and their GUIDs. Again, you can select (highlight) a particular view's GUID, then do a Right-Click to set the view GUID in the View text-box field. (As shown below).

Show List and View GUIDs
Select the View's GUID and Right-Click to set the View GUID into the View text-box field
You can then click on the Display Items button or the Display default List Attribute Names button (results of which are shown below). The Display default List Attribute Names will show you the internal names of the fields in your list.

More information on this is found here and the download for this tool is found here.

Hope you find it helpful!


DISCLAIMER: This posting is provided "AS IS" with no warranties. Use of included utilities are subject to the terms specified here. Use of any utility mentioned in this article is at your own risk, and any loss or software instability resulting as a direct result from using this utility is your own responsibility and we will not be held accountable. Please only use these utilities if you agree to these terms and conditions. By using these utilities, you are agreeing to these terms specified.



21 August 2010

How to find the GUID of a SharePoint List

Ever wondered how to find out the GUID of a SharePoint List? The GUID is a globally unique identifier which can be used to reference a particular list for use in coding or other means.

It is quite simple to find this out. The steps are outlined below:
  1. First of all, navigate to your SharePoint List that you need the GUID for.
  2. Click on the Settings drop-down menu, and then select List Settings.
  3. Look at the URL in the address bar of your browser, and copy everything after the = sign. This is the GUID, but the format is wrong.
  4. To format the GUID correctly, substitute the following characters:

    %7B  becomes  {
    %2D  becomes  -
    %7D  becomes  }

    So, for example, %7BC7EDB1A7%2D6F4A%2D4A44%2D8D4E%2D68C1179627DB%7D
    becomes {C7EDB1A7-6F4A-4A44-8D4E-68C1179627DB}
That's it!

SharePoint 2013 Update

In SharePoint 2013 there is a much easier way:
  1. Navigate to your SharePoint List.
  2. Click on List Settings.
  3. Click on Audience targeting settings.
  4. The URL ends with  List={C7EDB1A7-6F4A-4A44-8D4E-68C1179627DB} which already has your required GUID within the curly brackets.

    03 June 2010

    Retrieve SharePoint List Data and Bind to a DropDownList in ASP.NET

    If you have a SharePoint List within a Site, and want to bind the first column of that list to a DropDownList using ASP.NET, then the following steps are what you need to do:

    For this example, we are assuming your SharePoint Site URL is: http://mysharepointsite
    The name of the SharePoint List (which must reside within the above site!) is called ExampleList.
    You need to place the following code within the Page_Load event:

    if (!Page.IsPostBack)
         {
            using (SPSite site = new SPSite("http://mysharepointsite"))      
           {
              using (SPWeb web = site.OpenWeb())
               {
                 SPList list = web.Lists["ExampleList"];
                 dropSite.DataSource = list.Items;
                 dropSite.DataValueField = "Title"; //Value Property- first column is called Title
                 dropSite.DataTextField = "Title"; //Text property that is displayed on page 
                 dropSite.DataBind();
               }
            }
         }
    Hope that helps!
    Regards, Ash