string projectMemberValue = string.Empty;
try
{
//To Store
Multiple users
if
(spProjectListItem["ProjectMember"]
!= null)
projectMemberValue = spProjectListItem["ProjectMember"].ToString();
SPFieldUserValueCollection
oFieldUserValueCollection = new SPFieldUserValueCollection(spDLRWeb,
spProjectListItem["ProjectMember"].ToString());
spListItem["ProjectMember"]
= oFieldUserValueCollection;
}
catch { }
try
{
// To Store
Single user.
if
(spProjectListItem["ProjectOwner"]
!= null)
projectOwnerValue = spProjectListItem["ProjectOwner"].ToString();
SPFieldUser
userOwnerField = (SPFieldUser)spDLRWeb.Lists["Projects"].Fields.GetField("ProjectOwner");
SPFieldUserValue
fieldOwnerValue = (SPFieldUserValue)userOwnerField.GetFieldValue(projectOwnerValue);
projectOwner = fieldOwnerValue.User;
}
catch { }
|
Please add comments if it
is really helped you or for any issues.
No comments:
Post a Comment