【问题标题】:SharePoint 2013 Activity Event in Newsfeed新闻源中的 SharePoint 2013 活动事件
【发布时间】:2015-08-13 11:25:09
【问题描述】:

我需要在人们的 MySites 上的个人新闻源中添加自定义通知。我在网上找到了几个 SharePoint 2010 的教程和代码示例,并尝试对 SharePoint 2013 做同样的事情。它们都是关于使用ActivityManager 创建ActivityEvents

这是我尝试过的代码:

        var targetSite = new SPSite("URL to MySite webapp");
        SPServiceContext context = SPServiceContext.GetContext(targetSite);
        var userProfileManager = new UserProfileManager(context);

        var ownerProfile = userProfileManager.GetUserProfile("domain\\user1");
        var publisherProfile = userProfileManager.GetUserProfile("domain\\user2");

        var activityManager = new ActivityManager(ownerProfile, context);

        Entity publisher = new MinimalPerson(publisherProfile).CreateEntity(activityManager);
        Entity owner = new MinimalPerson(ownerProfile).CreateEntity(activityManager);
        ActivityEvent activityEvent = ActivityEvent.CreateActivityEvent(activityManager, 17, owner, publisher);
        activityEvent.Name = "StatusMessage";
        activityEvent.ItemPrivacy = (int)Privacy.Public;
        activityEvent.Owner = owner;
        activityEvent.Publisher = publisher;
        activityEvent.Value = "HELLOOOO";
        activityEvent.Commit();

        ActivityFeedGatherer.BatchWriteActivityEvents(new List<ActivityEvent> { activityEvent }, 0, 1);

CreateActivityEvent 函数中的 ID 17 用于StatusMessage 活动类型,其布局类似于资源文件中的{Publisher} says: {Value},因此我提供了ActivityEventValue 属性。

代码运行没有任何异常,在User Profile Service Application_ProfileDB 数据库中,我可以看到ActivityEventsConsolidated 表中出现了正确的条目。 但是该活动在活动提要中不可见,无论是在所有者的提要上,还是在发布者的提要上,即使这些人互相关注。我在 CA 中手动运行了活动源作业以更新活动源。 此外,我尝试使用自己的资源文件对自定义 ActivityTypes 执行相同的操作,结果相同:出现 ActivityEventsConsolidated 表中的条目(或 ActivityEventsPublished,如果 Owner=Publisher),但 MySite 上没有条目。

谁能帮忙?

【问题讨论】:

  • 如果您将此问题移至 Sharepoint StackExchange 站点,您可能会获得更多关注。这足够具体,以至于你想回答这个问题的人都在那边闲逛。

标签: sharepoint sharepoint-2013 feed mysite


【解决方案1】:

我自己找到了解决这个问题的方法。 在Central AdministrationSetup MySites 中,您必须启用Newsfeed 部分中的Enable SharePoint 2010 activity migration 设置才能支持SP2013 中的SP1010 旧活动。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-12
    • 2019-02-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多