0

I need to initialize an object of type TaxonomyFieldValueCollection and I need to pass ClientRuntimeContext and objectPath as two parameters.

Below is the constructor that I am using

TaxonomyFieldValueCollection taxonomyFieldValueCollection = 
new TaxonomyFieldValueCollection(runtimeContextClient,objectPath );

I am unable to find out what exactly I need to pass as objectPath, What is the second parameter objectPath here?

1

ObjectPath class Tracks how a client object is created in the ClientRuntimeContext class, so that the object can be re-created on the server. This class and its members are reserved for internal use and are not intended to be used in your code.

MSDN ObjectPath class

To Initializes a new instance of a TaxonomyFieldValueCollection object use

= new TaxonomyFieldValueCollection(
    context,
    fieldValue,
    creatingField)

context
Type: Microsoft.SharePoint.Client.ClientRuntimeContext

fieldValue
Type: System.String String to parse for value

creatingField
Type: Microsoft.SharePoint.Client.Field Field that this value is bound to

TaxonomyFieldValueCollection constructor

  • I went through these MSDN articles but when it comes to implementation there are two constructors for TaxonomyFieldValueCollection. 1st one uses two arguments which are ClientRuntimeContext and objectPath and the other one is the constructor you have mentioned above. I don't know the difference in these two constructors. There's no detailed description on these. I need two initialize a empty TaxonomyFieldValueCollection so i thought I should use the constructor with two arguments. Do you have any idea which one to use? – Sumudu P Apr 9 '18 at 14:19
  • @SumuduP You should use the constructor mentioned in the answer , not sure what you want to do exactly, but if you want to pass an empty value to the TaxonomyFieldValueCollection , you can set the second parameter "fieldValue" as empty string or null – A.Saéed Apr 9 '18 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.