Showing posts with label SharePoint2010. Show all posts
Showing posts with label SharePoint2010. Show all posts

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)


Thursday, November 13, 2014

Get current site web URL in JavaScript or JQuery

Use JavaScript variable name "L_Menu_BaseUrl" to get current web url and map it to any code in JavaScript.  This variable will be initialized on SharePoint pages by default. Below script will be always there when you do view source of the page:

<script type="text/javascript">

var L_Menu_BaseUrl="/ESearchCenter";
var L_Menu_LCID="1033";
var L_Menu_SiteTheme="";
</script>


OR 


You can make use of  below variables


1. var webUrl = _spPageContextInfo.webServerRelativeUrl;

2. var siteUrl = _spPageContextInfo.siteServerRelativeUrl;




Tuesday, August 26, 2014

Step by step - Enable Form based authentication in SharePoint 2010 or SharePoint 2013 (step by step FBA / Claims based authentication)

Finally done :)

I was planning to implement and write a article with screen shots about claims from long time.


Follow below steps to enable Form based authentication in SharePoint 2010 or SharePoint 2013.



Wednesday, August 20, 2014

Change Search tips link from advance search page - SharePoint 2010 Search


<script src="<link to file>jquery-1.11.1.min.js"></script>

<script>
$( document ).ready(function() {
$(".ms-advsrchtips" ).find('a').attr("href", "javascript:openDiaFormadvsrchtips();")
});

Why installing latest CU will not fix your problem?

Today I came across this very good article explaining about CU, Uber (Serve Package), Patch Baselines, PU and Farm patch version information.


http://blogs.technet.com/b/stefan_gossner/archive/2014/08/19/sharepoint-patching-demystified.aspx


Tuesday, June 17, 2014

"An error has occurred" While exporting OOB CEWP (Content editor web part)

Today, I wanted to create a reusable content editor web part. So I thought of crating one and then exporting it and import lator.

But when i clicked on export button on Content editor. It thrown me error as below:

Wednesday, March 26, 2014

Deploy custom BDC model to specific BCS Service / BDC service

SharePoint 2010 Central admin - create new web application screen throws 404 error

We faced this issue today after completing SharePoint 2010 installation on windows 7 machine.

After debugging we found that we were facing this because of Office 2013 installation on system.

So after uninstalling office 2013 the screens started working. :)

SharePoint 2010 central admin showing blank page

One of my team mate faced this issue few days back, After installing SharePoint 2010 when he tried to open central admin he got blank page.

We checked for all app pools and services but everything were fine, But after some googling we found solution that:

He forgotten to tick the Windows Authentication box when installing the IIS7 features. So:

Control Panel > Programs and Features > Turn Windows features on or off >Internet Information Services > World Wide Web Services > Security >tick ‘Windows Authentication’



After doing this our central admin was working as expected

SPDisposeCheck codes (Problem ID) table

ID
Pattern
SPDisposeCheckID_000
Unknown
SPDisposeCheckID_100
SPDisposeCheckID_110
SPDisposeCheckID_120
SPDisposeCheckID_130
SPDisposeCheckID_140


Run SPDisposeCheck command line SharePoint

1. Run cmd as administrator
2. Navigate to SPDisposeCheck install path i.e. "C:\Program Files (x86)\Microsoft\SharePoint Dispose Check"
3. Run this single command for XML Output i.e.

SPDisposeCheck.exe “C:\FolderPath\Solution.dll” -xml “C:\FolderPath\output.xml“




You can find xml file at specified path.

Event Receivers vs Workflows SharePoint 2010

Event Receivers
Workflows
Can execute either before or after the operation
Always executes after the operation
Can cancel the operation
Cannot cancel the operation as the item will have already been created
Cannot be launched manually by the user
Can be started manually by the user
Not designed for user interaction
Specifically designed for user interaction
Can execute in response to many different actions, including deletes
Can only execute in response to one of four events – Manual, an item being created, an item being edited, and an item being submitted for approval
Must be created in Visual Studio
Can be created with Visual Studio, Visio or SharePoint Designer


Workflows are mostly used for business process implementation and Event receivers are mostly used for one time activity based on trigger.

What is difference between Event Handler and Event receiver in SharePoint (Event Handler vs Event Receiver in SharePoint)

The below image answers the questions :



According to lot of articles on internet Event handler and Event Receiver are same. In SP2003 it was called as event handler and SP2010 it is called as Event Receiver.

But as per my understanding individual overridden method are called Event Handler and whole class is called Event receiver.

Comment out your thoughts on this.

Monday, December 16, 2013

Extension methode for web.AllowUnsafeUpdates


How we do it:

using (SPSite site = new SPSite(SPContext.Current.Site.Url))
            {
                using (SPWeb web = site.OpenWeb())
                {
                        web.AllowUnsafeUpdates = true;
                        SPList list = web.Lists.TryGetList("TestExtensionList");
                        SPListItem item = list.Items.Add();
                        item[SPBuiltInFieldId.Title] = TextBox1.Text.Trim();
                        item.Update();
                        web.AllowUnsafeUpdates = false;
                }

            }

How we can do it:


using (SPSite site = new SPSite(SPContext.Current.Site.Url))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    web.DoUnsafeUpdate(delegate()
                    {
                        SPList list = web.Lists.TryGetList("TestExtensionList");
                        SPListItem item = list.Items.Add();
                        item[SPBuiltInFieldId.Title] = TextBox1.Text.Trim();
                        item.Update();
                    });  
                }
            }

Tuesday, December 3, 2013

Creating connected web part in SharePoint 2010

Steps:
1. Create interface.
2. Create provider web part by implementing the interface created.
3. Create consumer web part.


Code blocks below:-


Thursday, October 31, 2013

Client object Model managed Code C# SharePoint



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Client;

namespace SPClient.NetConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            ClientContext clientContext = new ClientContext("http://igtehydzbnv02:8811/");
            Web site = clientContext.Web;
            List list = site.Lists.GetByTitle("TestListFilter");
            CamlQuery query = new CamlQuery();

            ListItemCollection itemColl = list.GetItems(query);


            clientContext.Load(itemColl);
            clientContext.ExecuteQuery();
            Console.WriteLine("Count: {0}", itemColl.Count);


            for (int i = 0; i < itemColl.Count; i++)
            {
                Console.WriteLine(itemColl[i]["Title"]);
            }
            Console.ReadLine();

        }
    }
}

Saturday, October 12, 2013

Error While Adding/ Retracting SharePoint WSP

Error In PowerShell

Install-SPSolution : Admin SVC must be running in order to create deployment ti
mer job.


Error In Central Admin

The timer job for this operation has been created, but it will fail because the administrative service for this server is not enabled.






Solution:-

Wednesday, September 25, 2013

Why to Dispose SPSite and SPWeb objects in SharePoint?


Several of the SharePoint Foundation objects, primarily the SPSite class and SPWeb class objects, are created as managed objects. However, these objects use unmanaged code and memory to perform the majority of their work. The managed part of the object is much smaller than the unmanaged part. Because the smaller managed part does not put memory pressure on the garbage collector, the garbage collector does not release the object from memory in a timely manner. The object's use of a large amount of unmanaged memory can cause some of the unusual behaviors described earlier. Calling applications that work with IDisposable objects in SharePoint Foundation must dispose the objects when the applications finish using them. You should not rely on the garbage collector to release them from memory automatically.

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...