0

I have a document set with some items . Each item when pressed gets you to the welcome page fields , "Employee name , employee supervisor , employee type etc. I want to put values into those welcome page fields . My general purpose is to use the profile store to fill the fields based on the employee name but for now i just want to find out how to fill those fields.

This has to be done programmatically

Anyone knows how to do it?

1 Answer 1

0

DocumentSet properties are just like any SPListItem property. By code, you would get the web, list, and item, set the item properties as you wish, then call the update method. Off the cuff, code might look similar to the following...

// Define some variables for example
private string myListName = "NameOfYourList";
private int myItemId = 34;
private string myPropertyName = "NameOfPropertyToUpdate";
private string myNewValue = "NewValueForProperty";

// Get reference to web, list, and item
SPWeb web = SPContext.Current.Web;
SPList list = new SPList();
list = web.Lists.TryGetList(myListName);
SPListItem item = new SPListItem();
item = list.getItemById(myItemID);

// Modify item properties 
item[myPropertyName] = myNewValue;

// Save the updates to the item
item.Update();

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.