Posts

Showing posts with the label App

SharePoint 2013 - Add Remote Event Receiver Programmatically

Below is sample code of associate a remove event receiver to a list in the host web.  This is assuming that you have already add the remote event receiver in the project. public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties)         {             SPRemoteEventResult result = new SPRemoteEventResult();             if (properties.EventType == SPRemoteEventType.AppInstalled)             {                 using (ClientContext clientContext = TokenHelper.CreateAppEventClientContext(properties, false))                 {                     if (clientContext != null)                     {                       ...

SharePoint 2013 Apps - SPLanguage URL Token is based on Locale

When developing SharePoint Apps for multilingual sites, you usually need to know what language to use on your site based on the SharePoint UI language.  By default, SharePoint passing in a SPLanguage URL query string to indicate the language (i.e. en-US). http://localhost:2782/Pages/Default.aspx?SPHostUrl=http%3A%2F%2Fdev%2Eironman%2E%2Ecom%2Fsites%2Ftest4& SPLanguage =fr%2DCA&SPClientTag=4&SPProductNumber=15%2E0%2E4481%2E1005 However, the SPLanguage value is not based on the language setting of the host web or user profile language preference (in case of MUI).  After a bit of testing, it turns out that the SPLanguage is based on the locale of the host web or user profile locale settings.  It is very weird ... I think.  And it's not really reflecting the UI language that an user seeing on the SharePoint site. To make it all working, it's better to write code to determine the actual language to display in your app.  The logic that I use (for MUI...

SharePoint 2013 Domain Certificate for Provider-Host App Development Environment

Creating Self-Signed (domain) Certificate for Provider-Hosted App This is the certificate that will be used on the IIS site to make it SSL enabled site.  It’s different from the one to create the STS Security token.  If the certificate is not created with proper domain associated, you’ll have issues with calling the App Event Receivers.  To create the certificate and set it up on IIS, following the instruction below: Open Visual Studio Developer Command Prompt and type the following command makecert -r -pe -n "CN= spapps.rchen.com " -b 01/01/2013 -e 01/11/2015 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sy 12 -sp "Microsoft RSA SChannel Cryptographic Provider" " D:\ Certs\SPAppCert.cer " certmgr /add " D:\ Certs\SPAppCert.cer " /s /r localMachine root *** You need to replace the domain ( spapps.rchen.com ) with your domain and the file path for the new certificate. Open MMC.exe and add C...

SharePoint 2013 - Get Personal Site News Feed Thread ID From Search Results

I’m trying to build an App that allows a group of people to get reports on my site news feed for any inappropriate words.   This post, http://www.techoui.com/post/2012/12/Working-with-Social-Hashtags2c-Search2c-and-the-SharePoint-2013-CSOM.aspx , get me started by using the search client API. However, I soon realized that the way to compile Thread ID is different for site news feed and personal site news feed.  Typical personal site news feed thread ID would look like below (from HTML source of personal site news feed page): 1.527d55a9388047439ee30c11b71e3650.a5c4bd89f0314468b1c887ed3a76f70e.725153485bc24e969fd4aba69179920d.0c37852b34d0418e91c62ac25af4be5b.1397059c08e54b95b7de51056f4e94fb.27.27.S-1-5-21-1481920619-292190258-1324514410-864729 It’s in this format [ActorId].[RootPostUniqueID].[RootPostID].[ListItemID].[SID]  The first 5 parts are the actor ID (I can’t figure out exactly what’s used to build this Actor ID.  The last part of the Actor ID ...