Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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)?

share|improve this question
    
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. –  PirateEric Dec 13 '11 at 13:31
add comment

1 Answer

up vote 1 down vote accepted

You can use a feature receiver for this, as described in the answer at: http://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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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