To query the properties of a specific portal object from a remote application, use the instance of IObjectQueryRow that represents the portal object.
Java
public static void printCommunityProperties(IObjectQueryRow communityObject) throws PropertyNotRequestedException { System.out.println("Object ID is " + communityObject.getID()); System.out.println("Created Date is " + communityObject.getCreated()); System.out.println("Description is " + communityObject.getDescription()); System.out.println("Name is " + communityObject.getName()); System.out.println("Last Modified Date is " + communityObject.getLastModified()); System.out.println("Owner ID is " + communityObject.getOwner()); System.out.println("Parent folder ID is " + communityObject.getParentFolderID()); if(communityObject.getObjectClass() == ObjectClass.Community) //only one instance so reference comparison is ok { System.out.println("Template ID is " + communityObject.getValue(CommunityProperty.CommunityTemplateID)); System.out.println("Footer ID is " + communityObject.getValue(CommunityProperty.FooterID)); System.out.println("Header ID is " + communityObject.getValue(CommunityProperty.HeaderID)); System.out.println("MandatoryTabOrder is " + communityObject.getValue(CommunityProperty.MandatoryTabOrder)); System.out.println("OwnerInfo is " + communityObject.getValue(CommunityProperty.OwnerInfo)); System.out.println("SiteMapRoot ID is " + communityObject.getValue(CommunityProperty.SiteMapRootID)); } else System.out.println("Not a community object!"); }
.NET (C#)
public static void PrintCommunityProperties(IObjectQueryRow communityObject) { Console.Out.WriteLine("Object ID is " + communityObject.GetID()); Console.Out.WriteLine("Created Date is " + communityObject.GetCreated()); Console.Out.WriteLine("Description is " + communityObject.GetDescription()); Console.Out.WriteLine("Name is " + communityObject.GetName()); Console.Out.WriteLine("Last Modified Date is " + communityObject.GetLastModified()); Console.Out.WriteLine("Owner ID is " + communityObject.GetOwner()); Console.Out.WriteLine("Parent folder ID is " + communityObject.GetParentFolderID()); if(communityObject.GetObjectClass() == ObjectClass.Community) //only one instance so reference comparison is ok { Console.Out.WriteLine("Template ID is " + communityObject.GetValue(CommunityProperty.CommunityTemplateID)); Console.Out.WriteLine("Footer ID is " + communityObject.GetValue(CommunityProperty.FooterID)); Console.Out.WriteLine("Header ID is " + communityObject.GetValue(CommunityProperty.HeaderID)); Console.Out.WriteLine("MandatoryTabOrder is "+ communityObject.GetValue(CommunityProperty.MandatoryTabOrder)); Console.Out.WriteLine("OwnerInfo is " + communityObject.GetValue(CommunityProperty.OwnerInfo)); Console.Out.WriteLine("SiteMapRoot ID is " + communityObject.GetValue(CommunityProperty.SiteMapRootID)); } else Console.Out.WriteLine ("Not a community object!"); }
.NET (VB)
Public Shared Sub PrintCommunityProperties(ByVal communityObject As IObjectQueryRow) Console.Out.WriteLine("Object ID is " & communityObject.GetID()) Console.Out.WriteLine("Created Date is " & communityObject.GetCreated()) Console.Out.WriteLine("Description is " & communityObject.GetDescription()) Console.Out.WriteLine("Name is " & communityObject.GetName()) Console.Out.WriteLine("Last Modified Date is " & communityObject.GetLastModified()) Console.Out.WriteLine("Owner ID is " & communityObject.GetOwner()) Console.Out.WriteLine("Parent folder ID is " & communityObject.GetParentFolderID()) If communityObject.GetObjectClass() = ObjectClass.Community Then 'only one instance so reference comparison is ok Console.Out.WriteLine("Template ID is " & communityObject.GetValue(CommunityProperty.CommunityTemplateID)) Console.Out.WriteLine("Footer ID is " & communityObject.GetValue(CommunityProperty.FooterID)) Console.Out.WriteLine("Header ID is " & communityObject.GetValue(CommunityProperty.HeaderID)) Console.Out.WriteLine("MandatoryTabOrder is " & communityObject.GetValue(CommunityProperty.MandatoryTabOrder)) Console.Out.WriteLine("OwnerInfo is " & communityObject.GetValue(CommunityProperty.OwnerInfo)) Console.Out.WriteLine("SiteMapRoot ID is " & communityObject.GetValue(CommunityProperty.SiteMapRootID)) Else Console.Out.WriteLine("Not a community object!") End If EndSub
To query for custom properties of an object, use the IExtendedData interface. This example prints out all the custom properties available on a portal object by enumerating through the available properties and printing out their name and value. To retrieve property IDs, use the standard object manager object querying method with ObjectClass.Property, and use the ID on the object returned to query for the properties you need.
Java
public static void printCustomProperties(IObjectQueryRow portalObject) throws PortalException, MalformedURLException, RemoteException { IExtendedData customProperties = portalObject.getExtendedData(); Enumeration propertyNames = customProperties.getNames(); String propertyName; while(propertyNames.hasMoreElements()) { propertyName = (String)propertyNames.nextElement(); System.out.println("Property "+ propertyName + " is "+ customProperties.getValue(propertyName)); } }
.NET (C#)
public static void PrintCustomProperties(IObjectQueryRow portalObject) { IExtendedData customProperties = portalObject.GetExtendedData(); IEnumerator propertyNames = customProperties.GetNames(); string propertyName; while(propertyNames.MoveNext()) { propertyName = (string)propertyNames.Current; Console.WriteLine("Property " + propertyName + " is " + customProperties.GetValue(propertyName)); } }
.NET (VB)
Public Shared Sub PrintCustomProperties(ByVal portalObject As IObjectQueryRow) Dim customProperties As IExtendedData = portalObject.GetExtendedData() Dim propertyNames As IEnumerator = customProperties.GetNames() Dim propertyName As String While propertyNames.MoveNext() propertyName = propertyNames.Current Console.WriteLine("Property " & propertyName & " is " & customProperties.GetValue(propertyName)) End While EndSub