1

I'm trying to create custom post to current user newsfeed in SharePoint 2013 Newsfeed. I must create posts in different languages like OTB functionality.

So I have something like this:

        SocialDataItem docLink = new SocialDataItem
        {
            ItemType = SocialDataItemType.Document,
            Text = "link to a document",
            Uri = docLinkUrl
        };

        SocialPostCreationData postCreationData = new SocialPostCreationData();

        postCreationData.ContentText = "Check this out {0}.";
        postCreationData.ContentItems = new SocialDataItem[1] { 
                docLink 
            };

I would like "Check this out" to be read from resource file or something like that. The same functionality is with OTB. If a user starts to follow a site this is added to his news feed and if you change current language the text is changed.

Example:

English language:

George is now following project.

Slovenian language:

George zdaj spremlja mesto »project«.

Is this even possible with a custom code?

Thanks for all your replies.

user759813
  • 21
  • 2

1 Answers1

0

It looks like you are trying to create a newsfeed post with custom code, maybe by using a button on an ASPX form. Anything will be possible with your custom code, so yes you could post to the users' feed in any language and yes you can use resource files to achieve this.

The newsfeed posts itself will only be in one language though and can never be in multiple languages.

The posts are actually stored in a Microfeed list within the users' personal site as list items. There is no possibility to store multiple versions (i.e. languages) of said list items in that list and hence you cannot have the same newsfeed post appear in multiple languages.

This would only be possible with quite complicated custom code: If for example you would create your own Newsfeed webpart which displays the regular newsfeed entries and additionally translated posts from another special custom list. Very complicated.

As for resource files you can follow any localization tutorial on localizing such as: Walkthrough: Localizing a Web Part. The correct localization will automatically be loaded by the current users' culture. This way you could post to the users feed in his/her language. Other users will also see that exact same post in the same language.

Dennis G
  • 21,405
  • 19
  • 96
  • 133
  • This is not what I was asking. When SharePoint creates a post (like in my example) it creates it with resource files (so i think) because if I change my language to any other it will change the langugage of the same post (according to installed languages). – user759813 Nov 21 '13 at 22:21
  • Ah correct, you are not talking about regular Newsfeed posts, but about the special posts like "XYZ has created a new post", "XYZ has followed ...". These posts are not persisted anywhere, they reside in the Distributed Cache and once it is restarted are gone forever. Yes, they contain stuff from Resource files, in particular the `osrvcore.resx` file. I'm not sure whether it is possible to create your own post and localize it, but why not try it with a resource file of your own? – Dennis G Nov 22 '13 at 13:12