Wednesday, September 24, 2014

Memory gates checking failed because the free memory is less than 5% of total memory. As a result, the service will not be available for incoming requests. To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.

Hi Friends,

Did you ever experienced below error while loading newly created Team Site on SharePoint 2013? 




Root cause: This is happening because of excess memory using by the SharePoint 2013.

I think there are 2 solutions. Just find below service and restart it. 

Solution 1



It will release some memory leaks on host controller. then refresh the browser to load the page.

Solution 2

1.Open IIS by running CTRL+R -> inetmgr
2.Identify the WebService that calling by the web page



3.Right Click -> Explore
4.Edit Web.config file
5.Modify node serviceHostingEnvironment

<serviceHostingEnvironment minFreeMemoryPercentageToActivateService="1" />


6.Just save web.config and do a IISRESET

double check your environment.

References:

http://stevemannspath.blogspot.com/2012/07/sharepoint-2013-opening-memory-gates.html
http://kancharla-sharepoint.blogspot.com/2013/04/sharepoint-memory-gates-checking-failed.html

That's it. Good Luck!

Tuesday, September 23, 2014

Error occured in deployment step 'Activate Features': Unable to locate the workflow's association data. To restore the association data..

Hey Friends,

Have you ever faced an issue like below, while developing Sequential workflow for SharePoint 2013, using VS 2012. 



Be cool, solution is there

Reason for the issue:

I'll give some context on Workflows. Workflows were having several number of Tasks and actions to perform, upon ItemAdding and ItemUpdating. Workflow will update entries in Task List (created for each workflow by default) and History list will record the steps executed (History list also get created). So while creating the workflow through VS 2012, Association between Task List, History List and Workflow will be created automatically by VS 2012. This error will appear after you have tried to redeploy same workflow code to different site collection and if your workflow already undergone some processing tasks.

Fix for the issue:

Just select the Workflow node from the project and check the properties window. notice the parameter "Auto Associate" and make it "False"



That's it, Rebuild the project and try to deploy to the site collection. Error will vanish.

Good Luck!

References:

http://blogs.msdn.com/b/exploring_technology_/archive/2011/10/19/error-occurred-in-deployment-step-activate-features-unable-to-locate-the-workflow-s-association-data.aspx


Wednesday, September 17, 2014

Provisioning a publishing web page with a simple webpart (SP2010 + VS 2010) - simplified steps

Hey Folks,

While I'm checking for the easiest way to publish a page with a webpart, I think I have found set of steps and thought to share for any users (Advance/Beginner). So let's jump in.

1.Open your VS 2010 environment with Administrator privileges.
2.Open new SP 2010 project (I have created project called "TestProvision")



Select correct site collection to be use with farm level deployment (make sure you have activated publishing features in your site collection)




3.Add Feature to host webpart deployment (this feature scoped as Site)





4.Create a folder as "CustomWebParts"

5.Add new item (Visual WebPart would be prefered)



6.Create another feature to host provisioning webpart page (scoped web)



7.Add Folder called "CustomPages"

8.Add new Module



9.Delete default "Sample.txt"

10.Add new .aspx page



11.Modify Element.xml file in Module and add below code

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="CustomPages" Url="Pages" Path="" RootWebOnly="FALSE">
    <File Name="SuperTest.aspx" Url="SuperTest.aspx" Type="GhostableInLibrary" Path="CustomPages\SuperTest.aspx" IgnoreIfAlreadyExists="TRUE">
      <Property Name="Title" Value="Super Test" />
      <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/BlankWebPartPage.aspx, Blank Web Part page" />
      <Property Name="ContentType" Value="MyPageLayoutContentType" />      
    </File>
  </Module>
</Elements>

Special Note: Module-> Url parameter is the document library that "SuperTest.aspx" page will deploy. In File->Path, you should add the absolute path to the page. I'm using Blank Web Part page layout. "ContentType" would be any contenttype as you wish.

Then add the webpart markup. Go to below file 



Add that code to Element file like below

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="CustomPages" Url="Pages" Path="" RootWebOnly="FALSE">
    <File Name="SuperTest.aspx" Url="SuperTest.aspx" Type="GhostableInLibrary" Path="CustomPages\SuperTest.aspx" IgnoreIfAlreadyExists="TRUE">
      <Property Name="Title" Value="Super Test" />
      <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/BlankWebPartPage.aspx, Blank Web Part page" />
      <Property Name="ContentType" Value="MyPageLayoutContentType" />
      <AllUsersWebPart WebPartZoneID="Head" WebPartOrder="1">
        <![CDATA[<?xml version="1.0" encoding="utf-8"?>
<webParts>
  <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
    <metaData>
      <type name="TestProvision.CustomWebParts.TestCustomVisualWebPart.TestCustomVisualWebPart, $SharePoint.Project.AssemblyFullName$" />
      <importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage>
    </metaData>
    <data>
      <properties>
        <property name="Title" type="string">TestCustomVisualWebPart</property>
        <property name="Description" type="string">My Visual WebPart</property>
      </properties>
    </data>
  </webPart>
</webParts>]]>
      </AllUsersWebPart>
    </File>
  </Module>
</Elements>

Special Note: Use any WebPartZone as you wish. I used "Head" zone just to demonstrate possibilities.

Your control can have simple thing like below



12.Open newly created .aspx file and copy below code

<%@ Page Inherits="Microsoft.SharePoint.Publishing.TemplateRedirectionPage,Microsoft.SharePoint.Publishing,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>
<%@ Reference VirtualPath="~TemplatePageUrl" %>
<%@ Reference VirtualPath="~masterurl/custom.master" %>

13.Open Manifest.xml file of the feature and double check below entries were automatically added. (If not modify the Manifest.xml file and add those entries)



14.Build the project

15.Package wsp

16.Deploy the .wsp to Site collection


that's it, go to Site Actions -> View All site contents -> Go to Pages Library (or just go to http://<YourSiteCollection/Pages/Forms/AllItems.aspx>)...You will notice the page will appear with your webpart.




Good luck!

Tuesday, September 16, 2014

configure SharePoint:DateTimecontrol to run server side for dynamically generated controls

I'm sure you may wonder, why do we care about Server side firing of default validation comes with SharePoint:DateTime Control. We just can enable IsRequired = "True" and configure <control>.ErrorMessage with appropriate styles.

Yes you are correct. However think about a scenario that client want to have server side validators plus client side validators like SharePoint:Datetime control. If this is the case, can you imagine the main issue. When end user clicks on "Submit" button first application fires client side validation. Then after fires the server side validators within separate post back. This issue would be a great headache for sure.

So let's dig into the issue using my scenario. All fields were generating dynamically using the SharePoint list fields and controls were in <tr><td></td></tr> sets. Ultimately no server control markup to configure attributes. then I have created the DateTime control object from the BaseFieldControl(Microsoft.SharePoint.WebControls) object get passed.

DateTimeField dateTimeField = (DateTimeField)control;

Then I have disabled IsRequired from there.

dateTimeControl.IsRequiredField = false;


After that I have added a label control dynamically (initially setting styles to hide on load), while adding the control id to the Session. So ultimately I can access the control through button code behind.

Finally, get the control id from session variables and check whether datetimecontrol is empty or not. If empty we will reset styles to show the error message label and hide if not. This was my simple solution within my context. Hope will help someone and thought to share.