0

I'm creating a list instance in an XML file and I have some fields which are of type "Person or group". In the XML I can specify it like this:

<Row>
     <Field Name='ID'>100</Field>
     <Field Name='Title'>Foo Bar</Field>
     <Field Name='MyGroup'>66;#SomeOfMyGroups</Field>
     .....
</Row>
......

Notice the declaration of the group: 66;#SomeOfMyGroups.

When I do this it works, but I don't know what the ID of the group will be at some point.

If I specify it like this <Field Name='MyGroup'>SomeOfMyGroups</Field> it no longer works, the row is excluded when the list instance is created.

How can I set the value for the row without relying on the ID and just use the name (the name never changes, the ID might)?

1
  • The ID never changes. The name could be changed, it might not in your project, but it is capable of being changed by someone with the right permissions. Commented Dec 13, 2011 at 13:31

1 Answer 1

1

You can use a feature receiver for this, as described in the answer at: https://stackoverflow.com/questions/7091281/sharepoint-2010-adding-sample-data-to-user-field-type.

This way you can generate valid ID+Name sets for your rows.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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