I want to check if the logged on user (Active Directory) is equal to the Created By field from a SharePoint list object. (Object can be a InfoPath form or word document or what ever…)
I can retrieve the Created By and Modified By field from a SharePoint list.
But the Created By field in SharePoint has the value of Display Name in Active Directory of that corresponding user.
Is there a way to retrieve the username or SID of the user who created the object in the list?
(I want to keep the Display Name in Active Directory)
I retrieve the current logged on user with:
System.Security.Principal.WindowsIdentity user_id;
user_id = System.Security.Principal.WindowsIdentity.GetCurrent();
string strSID = user_id.User; // Unique system id
string strUserName = user_id.Name.ToString(); // Username
I retrieve the Created By field with a DataSource Connection also in InfoPath