Posts

Error occurred in deployment step 'Install app for SharePoint': Sideloading of apps is not enabled on this site.

I was trying to create SharePoint apps using Visual Studio 2013 & when I tryied to deploy it was showing me an error : The following feature need to be enabled : Display Name: EnableAppSideLoading Id: ae3a1339-61f5-4f8f-81a7-abd2da956a7d Compatibility Level: 15 To enable sideloading feature, use the following PowerShell commands:     $site = Get-SPSite "http://your.site.url" $sideLoadingId = new-object System.Guid "ae3a1339-61f5-4f8f-81a7-abd2da956a7d" $site.Features.Add($sideLoadingId)

Log error in a separate file

You can log your applications errors in separate text file. Use this code public static void WriteException(string msg)         {             try             {                 SPSecurity.RunWithElevatedPrivileges(delegate()                 {                     string LogFile = SPUtility.GetVersionedGenericSetupPath("LOGS",15) + "\\SPErrorLog-" + DateTime.Today.ToString("MM-dd-yyyy") + ".txt";                     StringBuilder sMessage = new StringBuilder();                     msg = msg.Replace("<b>", "");                     msg = msg.Replace("</b>", "");                     msg = msg.Replace("<HR/>", "");                     sMessage.AppendLine("--------------------------------------------------------------------------------------------------------------------------------------------");                     sMessage.AppendLine(msg);                     if (!

Get error with details

You can log error with all details you want. Here is the example. You need to just pass the exception object & it will return you the whole error details which will be very helpful.   public static string GetErrorInfo(Exception ex)         {             StringBuilder errorRows = new StringBuilder();             StackTrace stackTrace = new StackTrace(ex, true);             StackFrame stackFrame = stackTrace.GetFrame(stackTrace.FrameCount - 1);             MethodBase methodBase = null;             try             {                 methodBase = stackFrame.GetMethod();             }             catch { }             errorRows.AppendLine("<b>Server         : </b>" + System.Environment.MachineName + "<HR/>");             errorRows.AppendLine("<b>Date Time         : </b>" + DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + "<HR/>");             try             {                 errorRows.AppendLine("&l

Publishing Features for Site Collection & Web

If you are going to created & deploy the custom master page then you should activate the following publishing features : Display Name PublishingSite Title SharePoint Server Publishing Infrastructure Scope Site ID f6924d36-2fa8-4f0b-b16d-06b7250180fa Description Provides centralized libraries, content types, master pages and page layouts and enables page scheduling and other publishing functionality for a site collection. Display Name PublishingResources Title Publishing Resources Scope Site ID aebc918d-b20f-4a11-a1db-9ed84d79c87e Description Enable Publishing for site collection. Display Name Publishing Title Publishing Scope Web ID 22a9ef51-737b-4ff2-9346-694633fe4416 Description Enable Publishing in a web. Display Name PublishingLayouts Title Page Layouts and Master Pages Pack Scope Site ID d3f51be2-38a8-4e44-ba84-940d35be1566 Description Publishing Lay

Unable to create publishing pages in the pages library in SharePoint 2013

Go to  Original Post   Reproduction Steps: 1) Browse to: https://contoso.com/site/myteam 2) site Actions 3) View All Site Content 4) Pages 5) Library Tools > Documents 6) New Document 7) Page 8) Get an error message saying: An unexpected error has occurred. Troubleshoot issues with Microsoft SharePoint Foundation. Correlation ID: 5a3ab0c7-9b95-4c20-a5a7-04637fe0a120 Date and Time: 2013/12/04 04:19:04 PM When you pull the ULS logs you see: Microsoft.SharePoint.Publishing.InvalidPublishingWebException: The site is not valid. The ‘Pages’ document library is missing. at Microsoft.SharePoint.Publishing.PublishingWeb.GetPublishingListWithCleanup(PublishingListType list, Boolean throwExceptionOnInvalidWeb) at Microsoft.SharePoint.Publishing.Internal.CodeBehind.BasePageSettingsPage.get_PageListRoot() at Microsoft.SharePoint.Publishing.Internal.CodeBehind.BasePageSettingsPage.SetParentUrlLabel() at Microsoft.SharePoint.Publishing.Internal.CodeBehind.BasePageSettingsPage.LoadValues() at Micro

Create SharePoint 2013 Project on your local machine where you don't have SharePoint 2013 installed in Visual Studio 2013

Go to the SharePoint Server where you have SharePoint 2013 is installed & follow the steps: Go to Run and type "regedit" Navigate towards HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Right click on 15.0 and click Export. Save the exported file Now go to your machine where SharePoint is not installed and follow these steps: Now open Registry on your machine Import the 15 directory which was exported from SharePoint server Open Powershell Run this command Set-ItemProperty -Path "HKLM:\Software\Microsoft\Shared Tools\web server extensions\15.0\" -Name "Location" -Value "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\" Now open visual studio 2013 & create new solution for SharePoint 2013 , You won't get any error message.

Access List properties with REST APIs

Syntax to use REST API for List:                 <sharepoint web url>/_api//web/lists/GetByTitle('List Title')/<property name> Properties which can be retrieved: S. No Property Type 1 AllowContentTypes Boolean 2 BaseTemplate Int32 3 BaseType Int32 4 BrowserFileHandling Int32 5 ContentTypes SP.ContentTypeCollection 6 ContentTypesEnabled Boolean 7 Created DateTime 8 DataSource SP.ListDataSource 9 DefaultContentApprovalWorkflowId GUID 10 DefaultDisplayFormUrl String 11 DefaultEditFormUrl String 12 DefaultNewFormUrl String 13 DefaultView SP.View 14 DefaultViewUrl