Sunday, November 29, 2015

Bundling and Minification - SharePoint best practice

Found this really helpful article about bundling and minification using visual studio extension:


https://msdn.microsoft.com/en-in/library/dn850363.aspx

SharePoint script on demand

This is very old now and exists in market from long time for SharePoint, So thought of summarizing it once.

1.     Create file with name ShareTechPoint.js and below content

function sayHello() {
  alert("Hello");
}
//Notify SharePoint that the custom file has loaded.
SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs("ShareTechPoint.js ");


2.     Now write the below code in another  HTML/ascx/aspx file

<script type="text/ecmascript">
 
    function runCode() {
        SP.SOD.RegisterSod(‘ShareTechPoint.js ', 
                            '/StyleLibrary/ShareTechPoint.js');
        var x = ExecuteOrDelayUntilScriptLoaded(sayHello, 
                              "ShareTechPoint.js ");
    }
 
</script>
 
<input id="Button1" type="button" value="Run Code" 
onclick="runCode()" />


 


This is how you can implement Script on demand for SharePoint.

References
  • http://www.ilovesharepoint.com/2010/08/sharepoint-scripts-on-demand-spsod.html
  • http://www.kalmstrom.com/Tips/SPDevDynamicLoading.html

Client web part / App Part showing the blank iframe on page

Hello all - While creating first hello client web part many times people face this issue that there cleint web part show blank window after adding on page.

For showing content on page need to allow framing on page as client web parts loan in iFrame.


<WebPartPages:AllowFraming runat="server" />


Check for above line of code on client web part file. If not preset add it there.

Wednesday, November 18, 2015

Download all Site collection documents / Files using Powershell in specific folder

I updated the script written by "Nico Martens" in below blog post

http://sharepointrelated.com/2014/11/11/download-all-content-in-a-site-collection/

Below script will download all your documents in specific folder of Site and List

Sunday, September 6, 2015

Tuesday, August 25, 2015

List of feature improvement in SharePoint 2016



Find below list which is full of awesomeness about SharePoint 2016 improvements:


1. Lists in SharePoint 2016 are Optimized(5000 list item threshold),  SP2016 auto manages the index to optimize large lists.

2. Stsadm is deprecated but it will still work and can be used for running commands that are not available through PowerShell yet.

3. SPFX is will be available for SharePoint 2018 on prem feature pack 2 onwards


Will Update more in some time



SharePoint 2016 installation step-by-step

Today Microsoft launched preview beta version of SharePoint 2016. 

Download link : http://www.microsoft.com/en-us/download/details.aspx?id=48712

New features added in SharePoint 2016  : https://technet.microsoft.com/en-us/library/mt346121(v=office.16).aspx



Lets get hands on installation and user experience using below step by step installation screens of SharePoint 2016 

1. Installing Pre-requisite




2. Splash Screen



3. Installation started for SharePoint 2016


Product key for 180 Days trial "NQTMW-K63MQ-39G6H-B2CH9-FRDWJ"



4. Installation done Run Config wizard 



 As you know we dont have standalone concept in SharePoint 2016. So need to configure single server FARM and install DB first. Database Installation in progress for further processing.













Friday, July 31, 2015

Sign in as different user in SharePoint 2013

By default in SharePoint 2013 we don't get option to sign as different user. If you want to get the same 'Sign in as different user' which was there in SharePoint 2010.



Please follow below steps to add it to SharePoint 2013.


1. Go to Control Templates folder

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES


2. Edit Welcome.ascx




3. Add below code lines at second place of MenuItemTemplate

<SharePoint:MenuItemTemplate runat="server" ID="ID_LoginAsDifferentUser"  
   Text="<%$Resources:wss,personalactions_loginasdifferentuser%>"  
   Description="<%$Resources:wss,personalactions_loginasdifferentuserdescription%>"  
   MenuGroupId="100"  
   Sequence="100"  
   UseShortId="true"  
/>




4. Now go to SharePoint site and refresh the page.






Simple!!!!!!!


Tuesday, March 3, 2015

List Workflows VS Reusable List Workflows VS Site workflows



List Workflows

A list workflow is the type of workflow that was available in SharePoint 2007. Because it has the context of the list for which it was created, list workflows automatically have access to the values of the custom fields for the list item on which they will run, such as the custom Notes field for a document library. List workflows cannot be made available to other lists or libraries on this or other sites. To have the same workflow functionality for multiple lists you must manually recreate the workflows in all locations.
If you know that you will only need the workflows you are designing for a specific list, the list workflow has the advantage of automatically making available the custom fields of the lists.

Reusable List Workflows

You can create a reusable list workflow (reusable workflow) in the top-level site in the site collection, and that workflow can be made globally reusable — meaning that the workflow can be associated to any list, library, or content type in the site collection. You can also create a reusable workflow in any subsite in the site collection; this workflow is available for reuse in that particular subsite.
You can also export a reusable workflow from one site and then upload and activate that workflow in a different site. For example, you can create a reusable workflow in a test environment, test it, and then export it to a production environment. SharePoint Designer 2010 supports exporting a workflow as a template.
Reusable workflows, by default, don’t have the context of a specific list or library. Therefore, by default, they provide only the columns that are common across lists and libraries, such as Created and Created By.
If your reusable workflow requires certain columns to be present in the list or library that you associated it to, you can add those columns as association columns. Association columns get added automatically to a list or library when a reusable workflow is associated to that list or library.
When you create a reusable workflow, you can alternatively choose to filter your reusable workflow to a specific content type. This enables you to work with the fields of the content type in SharePoint Designer 2010. For example, if a reusable list workflows is associated with the Document content type, you view and use in your workflow fields that are specific to the content type, such as Document ID. Then, in the browser, you can associate your reusable workflow either to a specific content type or to any content type that inherits from that content type. If you associate a workflow to a site content type, you make that workflow available for all items of that content type in every list and library on the site to which that content type has been added. You can even make it available for sites in a collection if the workflow is configured to be a Globally Reusable Workflow.
If you want users to be able to use the workflows you are designing on multiple sites, lists, libraries, and content types, a reusable workflow will probably best meets your needs. We expect that most workflows for SharePoint 2010 will use reusable workflows.

Site workflows

A site workflow is associated to a site — not to a list, library, or content type. So unlike most workflows, a site workflow is not running on a specific list item. Because of this, many of the actions that are available for items not available for site workflows.
In the browser, you start a site workflow or view the status of running site workflows by clicking the Site Actionsmenu, click View All Site Content, and then clicking Site Workflows.
If you want to create a workflow, but don’t need a list, library, or content type for the workflows, a site workflow will probably best meet your needs. For example, you can create a site workflow as a way for people to provide feedback about your site.

Site workflows can only be started manually.


(Copied from https://support.office.com/en-ca/article/Introduction-to-designing-and-customizing-workflows-32c9c0bf-5e20-4f74-8b9c-d3ea79f2962b)


SharePoint document metadata not updating

I faced a weird issue today, Metadata for document which has lookup column was not updating even after saving the item. There was no erro...