I m working on SharePoint Add-ins using remote event receiver. I have created an add-in for my SharePoint site to get log of item added, item updated and item deleted details. I am getting item id which provides detail about the item on which operation is performed. How can I get details of user who has modified the file?
Here is my code for item adding:
if (clientContext != null)
{
//Get reference to the host web list with name Feedback
var documentsList =
clientContext.Web.Lists.GetByTitle("DemoRemoteEventReceiverList");
clientContext.Load(documentsList);
clientContext.ExecuteQuery();
string remoteUrl =
"https://myApp.azurewebsites.net/Services/RemoteEventReceiver.svc";
//Create the remote event receiver definition
EventReceiverDefinitionCreationInformation newEventReceiver = new
EventReceiverDefinitionCreationInformation()
{
EventType = EventReceiverType.ItemAdded,
ReceiverAssembly = Assembly.GetExecutingAssembly().FullName,
ReceiverName = "RemoteEventReceiver1",
ReceiverClass = "RemoteEventReceiver1",
ReceiverUrl = remoteUrl,
SequenceNumber = 15001
};
//Add the remote event receiver to the host web list
documentsList.EventReceivers.Add(newEventReceiver);
clientContext.ExecuteQuery();
}
Try
using (ClientContext clientContext = TokenHelper.CreateRemoteEventReceiverClientContext(properties))
{
if (clientContext != null)
{
var user = clientContext.Web.CurrentUser;
clientContext.Load(user);
clientContext.ExecuteQuery();