Posts

Allow anonymous access to SharePoint application pages in the _layouts directory

Image
Sample Code public partial class ApplicationPage1 : UnsecuredLayoutsPageBase {     protected void Page_Load( object sender, EventArgs e)     {     } }   Create the project In Visual Studio 2010, create a new “Empty SharePoint Project” and name it “MyAnonymousWebPages”. Click OK Enter your SharePoint site Select “Deploy as a farm solution” Adding the custom Pages Next, we need to map the ‘layouts’ directory to our project, so our files are deployed there. Right click on the project name ‘MyAnonymousWebPages’ > Add > SharePoint “Layouts” Mapped Folder SharePoint will automatically add a folder under ‘layouts’ with the name of our project. Right click on this folder >Add > New Item > Application Page Name the page “HelloWorld.aspx” Your project should now look like this: Allowing anonymous access So far, we haven’t done anything special. The steps we’ve taken is the basic approach to ...

Provider Hosted App – Upload Large Files using CSOM

Now the method to upload larger files is exactly the same. We only have to use  FileCreationInformation.ContentStream   property instead of  FileCreationInformation.Content property. The whole code is present below:       var  spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext, SPHostUrl);              using  ( var  clientContext = spContext.CreateUserClientContextForSPAppWeb())             {                  if  (clientContext !=  null )                 {                      //file...

SharePoint 2013 High Trust Provider Hosted App: Upload Large Files

Image
      Using the "ContentStrem" property, we can upload files of large size in the SP Document Library. Refer to: https://msdn.microsoft.com/en-us/library/office/dn904536.aspx In the web.config of our remote web application, set the following values: There is one more setting required. Open IIS then navigate to your remote web site. Click on "Request Filtering" . Click on "Edit Feature Settings" and change the value of "Maximum allowed content length". References https://msdn.microsoft.com/en-us/library/office/dn904536.aspx http://www.c-sharpcorner.com/UploadFile/Vipul.Kelkar/sharepoint-2013-high-trust-provider-hosted-app-upload-larg/

Downloading Wsp from SharePoint Central Admin

U sing C#: protected void btnDownloadWSP_Click(object sender, EventArgs e)         {             SPSolutionCollection allSolutions = SPFarm.Local.Solutions;             foreach (SPSolution mySolution in allSolutions)             {                 SPPersistedFile myWSP = mySolution.SolutionFile;                 if (myWSP.Name == "Sample.wsp")                 {                     myWSP.SaveAs("c:\\Export All Solutions\\" + mySolution.Name);      ...

A Guide to SharePoint Naming Conventions

http://www.nothingbutsharepoint.com/2010/12/07/a-guide-to-sharepoint-naming-conventions-aspx-2/

Check current user exists in a group using an AJAX call

$.ajax({     url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups/getByName('Site Members')/Users?         $filter=Id eq " + _spPageContextInfo.userId,     type: "GET",     cache: true,     async: false,     headers:{         "ACCEPT": "application/json;odata=verbose"     },     success: function (data) {         if (data.d.results[0] != undefined) {         //user is a member         }     },     error: function () {     } });

SharePoint 2013 Cross-Site Publishing Overview

http://gowthamrajamanickam.blogspot.in/2015/03/sharepoint-2013-cross-site-publishingxsp_2.html