Export (0) Print
Expand All

Setting the Item Namespace for the GetProperties Method

You can use the ItemNamespaceHeader SOAP header in Reporting Services to retrieve item properties based on two different item identifiers: the full path of the item or the ID of the item.

When you make a call to the GetProperties method, you normally pass as an argument the full path of the item for which you want to retrieve properties. By using ItemNamespaceHeader, you can set the SOAP header for your method call to enable you to use GetProperties by passing the ID of the item as an identifier.

The following code sample retrieves the values for item properties based on the ID of the item.

Note Note

By default, you do not need to set a value for the ItemNamespaceHeader if you pass to the GetProperties method the full path name as the item identifier.

using System;
using System.Collections;


class Sample
{
   static void Main()
   {
   ReportingService2010 rs = new ReportingService2010();
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
      rs.Url = "http://<Server Name>/reportserver/ReportService2010.asmx";

      CatalogItem[] items;

      try
      {
         // Need the ID property of items. Normally, you would already have 
         // this stored somewhere.
         items = rs.ListChildren("/AdventureWorks Sample Reports", false);

         // Set the item namespace header to be GUID-based
         rs.ItemNamespaceHeaderValue = new ItemNamespaceHeader();
         rs.ItemNamespaceHeaderValue.ItemNamespace = ItemNamespaceEnum.GUIDBased;

         // Call GetProperties with item ID.
         if (items != null)
         {
            foreach( CatalogItem item in items)
            {
               Property[] properties = rs.GetProperties(item.ID, null);
               foreach (Property property in properties)
               {
                  Console.WriteLine(property.Name + ": " + property.Value);
               }
               Console.WriteLine();
            }
         }
      }

      catch (Exception e)
      {
         Console.WriteLine(e.Message);
      }
   }
}
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft