|
||
|
API examples for newer versions Please visit the latest API Examples documentation to view API examples for newer versions of Kentico. |
The following example adds the cmseditor user to the current user's contact list.
private bool AddUserToContactList() { // Gets "cmseditor" UserInfo object UserInfo user = UserInfoProvider.GetUserInfo("cmseditor");
if (!ContactListInfoProvider.IsInContactList(CMSContext.CurrentUser.UserID, user.UserID)) { // Adds "cmseditor" to the current user's contact list ContactListInfoProvider.AddToContactList(CMSContext.CurrentUser.UserID, user.UserID);
return true; }
return false; } |
The following example removes the cmseditor user from the current user's contact list.
private bool RemoveUserFromContactList() { // Gets "cmseditor" UserInfo object UserInfo user = UserInfoProvider.GetUserInfo("cmseditor");
if (ContactListInfoProvider.IsInContactList(CMSContext.CurrentUser.UserID, user.UserID)) { // Removes "cmseditor" from the current user's contact list ContactListInfoProvider.RemoveFromContactList(CMSContext.CurrentUser.UserID, user.UserID);
return true; }
return false; } |