【问题标题】:How to get user details using remote event receiver SharePoint?如何使用远程事件接收器 SharePoint 获取用户详细信息?
【发布时间】:2020-02-11 15:16:37
【问题描述】:

我正在使用远程事件接收器处理 SharePoint 加载项。我为我的 SharePoint 网站创建了一个加载项,以获取添加的项目、更新的项目和删除的项目详细信息的日志。我正在获取项目 ID,它提供有关执行操作的项目的详细信息。 如何获取修改文件的用户的详细信息?

这是我添加项目的代码:

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();
}

【问题讨论】:

    标签: c# sharepoint-online sharepoint-addin


    【解决方案1】:

    试试

    using (ClientContext clientContext = TokenHelper.CreateRemoteEventReceiverClientContext(properties))
                {
                    if (clientContext != null)
                    {
                        var user = clientContext.Web.CurrentUser;
                        clientContext.Load(user);
                        clientContext.ExecuteQuery();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-27
      • 1970-01-01
      • 2013-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多