Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Programmatically get properties name

  Asked By: Justin    Date: Feb 07    Category: Sharepoint    Views: 1325

I've a piece of code that gets the profiles of a specific folder. How can I
get the properties of that profile?

Dim oFolder As New PKMCDO.KnowledgeFolder
Dim strProfile As String

oFolder.DataSource.Open "MyFolder"
strProfile=oFolder.ExpectedContentClass(0)
'(..get properties names/List values/ect...)

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Indu Raj     Answered On: Feb 07

You can use the following code  for getting the
properties of profile

Set lobjKnWk = New PKMCDO.KnowledgeWorkspace
Set lobjKnCC = New PKMCDO.KnowledgeContentClass
Set lobjKnPropDef = New PKMCDO.KnowledgePropertyDef
Set ldictKnProperty = New Scripting.Dictionary
'bind to the workspace
lobjKnWk.DataSource.Open Trim(gsWorkspaceName), , , ,
, Trim(gsCoordID), Trim(gsCoordPassword)

'form the total urn path for the profile
'lsProfilePath = "urn:content-classes:" +
Trim(sProfileName)
lsProfilePath = Trim(sProfileName)
'retrieve all the properties  associated with a
document profile
Set lobjKnCC = lobjKnWk.GetObject(lsProfilePath)

'for each property identify whether it is mandatory
and/or multivalued
lsListBox = 0
For Each lKnObj In
lobjKnCC.Fields("urn:schemas-microsoft-com:publishing:propertyorder").Underlying\
Value
msgbox lobjKnPropDef.Name
next


and for getting the list values you can use this code
'bind to the workspace
lobjKnWk.DataSource.Open gsWorkspaceName, , , , ,
Trim(gsCoordID), Trim(gsCoordPassword)

'retrieve all the properties associated with a
document profile
Set lobjKnPropDef = lobjKnWk.GetObject(sPropName)
lsPropUrn = lobjKnPropDef.Dictionary
larrValues =
lobjKnWk.GetObject(lsPropUrn).DictionaryValues
For licntr = 0 To UBound(larrValues)
msgbox CStr(larrValues(licntr))
Next

 
Didn't find what you were looking for? Find more on Programmatically get properties name Or get search suggestion and latest updates.