Monday, July 22, 2013

SharePoint 2013 video tutorials

SharePoint 2013 training for developers


http://msdn.microsoft.com/en-US/sharepoint/fp123633


Here are some SharePoint 2013 video tutorials for developers provided by microsoft. The download link is available below.

1. Introduction to Office 2013 and SharePoint 2013 Development

2. SharePoint 2013 app model for developers

3. SharePoint 2013 developer tools

4. Hosted apps in SharePoint 2013

5. Create cloud-hosted apps for SharePoint 2013

6. SharePoint 2013 Client object model (CSOM) and REST APIs

7. OAuth and application identity in SharePoint 2013

8. Develop SharePoint 2013 remote event receivers

9. Workflow changes and features in SharePoint 2013

10. Business connectivity services changes in SharePoint 2013

11. Search features and changes in SharePoint 2013

12. Enterprise content management changes in SharePoint 2013

13. Web content management changes and features in SharePoint 2013

14. Social features in SharePoint 2013

15. Office services in SharePoint 2013

16. Create mobile apps for SharePoint 2013

17. Develop apps for Office 2013

18. Project Server 2013 training for developers

Please follow this link for the videos above.


Wednesday, July 17, 2013

SharePoint 2010: Client Object Model for JavaScript (ECMAScript)

Use ECMAScript Library

At first use Visual Studio 2010 to create a SharePoint web part project. As a result, VS2010 will open a ascx control for you on the designer. 

1. Add reference to js file:

To use Client OM, add an entry like below in your web part ascx control. For your information, there’s an debug version of the sp.js called sp.debug.js which you can use for debugging but should not be used in production.
<SharePoint:ScriptLink Name="SP.js" runat="server" OnDemand="true" 
    Localizable="false" />
Here, OnDemand means whether the sp.js file need to be loaded on demand (not in page load) or not.

2. Add FormDigest tag:

If your code modifies SharePoint content add a FormDigest control inside your page. The FormDigest add a security token inside your page based on user, site and time. Once the page is posted back the security token is validated. Once the security token is generated it’s valid for a configurable amount of time. Add the FormDigest inside <form>…</form> tag, as shown below:
<SharePoint:FormDigest runat="server" />
For more information on FormDigest follow the links below:

3. Use Client OM to retrieve data:

Now you can use SharePoint ECMAScript library. Lets dissect the code snippet below. The first thing in using this library is that you need to get the ClientContext (just like SPContext). Then the context.get_web returns the current web (just like SPContext.Current.Web). Then client context’s load method is invoked passing the web object. Then the executequery method is invoked asynchronously passing two functions: onSuccess and OnFailed which will be called on success and fail correspondingly.
<script type="text/javascript">
    function getWebProperties() {
        var ctx = new SP.ClientContext.get_current();
        this.web = ctx.get_web();
        ctx.load(this.web);
        ctx.executeQueryAsync(Function.createDelegate(this, this.onSuccess),
            Function.createDelegate(this, this.onFail));
    }
    function onSuccess(sender, args) {
        alert('web title:' + this.web.get_title() + '\n ID:' + this.web.get_id() + 
            '\n Created Date:' + this.web.get_created());
    }
    function onFail(sender, args) {
        alert('failed to get list. Error:'+args.get_message());
    }
</script>
By calling getWebProperties method from any web part, you can get the current web’s title, id and creation date.

4. Load minimal data you need:

In the above code snippet, the Ctx.load method is invoked with only one parameter (web). The load method will load all properties of the web object. But we are only using Id, Title and Created Date properties. If you know which properties you are interested in, you can pass the properties names in the load method and only those properties will be loaded. For example the following load method will return only ID, Title and Created Date.
ctx.load(this.web,'Title','Id','Created');
Remember, here the properties names are properties of SPWeb. You need to pass Title instead of title. The properties name uses CAML casing. You can get the full lists of ECMAScript namespaces, object, properties following the link on MSDN. The document is not final yet and may be changed. You can also look into the sp.debug.js file in the folder “Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS”, to get an idea of objects, properties and methods of ECMAScript Client OM.

5. Execute your JavaScript function after sp.js is loaded:

Sometimes you may need to execute your JavaScript (that uses ECMAScript Client OM) on page load in the browser. But since your JavaScript is using sp.js file and if the sp.js file is not loaded yet (since to lazy loading nature of sp.js), when your custom JavaScript will be executing, you’ll get your JavaScript function not executed. In this case you need to make sure your JavaScript code runs after sp.js finishes loading. You can do so by putting your JavaScript method call inside a js function as shown below:
ExecuteOrDelayUntilScriptLoaded(myjsfucntion, "sp.js");
Putting your JavaScript function (i.e., myjsfunction) inside the ExecuteOrDelyUntilScriptLoaded method delays your method call until the sp.js file is loaded.

6. Update with ECMAScript Library:

You can use the Client OM to update SharePoint contents. The following code snippet shows how to update web title.
<script type="text/javascript">
    function updateTitle() {
        var ctx = new SP.ClientContext.get_current();
        this.web = ctx.get_web();
        web.set_title('UpdatedTitle');
        this.web.update();
        ctx.executeQueryAsync(Function.createDelegate(this, this.onUpdate),
            Function.createDelegate(this, this.onFail));
    }
    function onUpdate(sender, args) {
        alert('title updated');
    }
    function onFail(sender, args) {
        alert('failed to update title. Error:'+args.get_message());
    }
</script>
By calling the updateTitle method from any web part or SharePoint application pages, you can change the title of current web site (where the web part or application page is deployed). For your information, in ECMAScript Client OM, to get an property use get_propertyName and to set a property use set_propertyName. To update list with ECMAScript library you need to add FormDigest tag.

Use JQuery with ECMAScript

You can use JQuery with ECMAScript without any conflict. As usual, you need to add jquery.js file reference to your page/web part or in master page. Then you can use JQuery as like normal asp.net applications. But make sure that if you need to execute any JavaScript function on page load event, you put this inside ExecuteOrDelayUntilScriptLoaded function.

Deployment Consideration

SharePoint provides two sets of JavaScript file: minified and unminified/debug version. For example sp.js file is minified and sp.debug is minified and debug version. The default master page in SharePoint has a scriptmanager in the page and whose ScriptMode is set to auto, as a result the minified version of js file loaded. If you want to use debug version you can add the <deployment retail="false" /> in the <system.web> section of the web.config. In the production you need to remove this entry to make sure minified version is used. The ECMAScript supported in the following browsers:
  • Microsoft Internet Explorer 7.0 or greater.
  • Firefox 3.5 or greater
  • Safari 4.0 or greater

Create visual webpart in SharePoint 2013

In SharePoint 2013, both web user control and the webpart class are merged to one template file, not like SharePoint 2010.

To create visual webpart follow below steps:

Step-1:
Open Visual Studio 2012, From the left side select Office/SharePoint and then from the right hand side select SharePoint 2013 Visual Web Part.

Step-2:
In SharePoint 2013 you can deploy visual webpart as a sandboxed solution apart from farm solution. So in the Next screen select Deploy as a farm solution and click on Ok. Also you can give the site URL for debugging.

Step-3:
Then write the code in the code behind file as in SharePoint 2010.

Step-4:
After finish coding you can debug or deploy the webpart.

Create new site group in SharePoint 2013

Follow below steps to create new site SharePoint group:

Step-1:
From the Top level of site collection go to Site Actions -> Site Settings.
Step-2:
Then from the Site Settings page from Users and Permissions group select People and Groups.

Step-3:
Now in the Group Management area, Select the Groups link from the left-hand navigation menu. This will open the Groups listing page.

Step-4:
On the New menu of the toolbar, select Create New Group. This will open the Create Group Page.

Step-5:
In the Create Group page, Enter name of the group, also enter the Description of the group in the About Me section. Then enter the group owner name. In the Group Settings section chose from the radit button and click on Create.

Add a Geolocation column to a list programmatically in SharePoint 2013

Here in this article we will discuss about how we can add a Geolocation column to a SharePoint 2013 list using SharePoint 2013 client object model.

SharePoint 2013 Preview introduces a new field type named Geolocation that enables you to annotate SharePoint lists with location information. In columns of type Geolocation, you can enter location information as a pair of latitude and longitude coordinates in decimal degrees or retrieve the coordinates of the user’s current location from the browser if it implements the W3C Geolocation API.

First we need to add the below 2 dlls to work with SharePoint 2013 client object model.

Microsoft.SharePoint.Client.dll

Microsoft.SharePoint.Client.Runtime.dll

Then we need to write the using statement like below:

using Microsoft.SharePoint.Client;

Below is the full code:

ClientContext context = new ClientContext("http://site url"); 

List oList = context.Web.Lists.GetByTitle("MyCustomList");

oList.Fields.AddFieldAsXml("<Field Type='Geolocation' DisplayName='Location'/>",true, AddFieldOptions.DefaultValue);                                        

oList.Update();

context.ExecuteQuery();

Difference between SharePoint designer and Visual Studio workflows

Below are some differences between SharePoint designer workflows and Visual Studio workflows.

SharePoint Designer:
- SharePoint Designer is a code-free environment.

- Through designer we can make Sequential workflows only.

- Workflows created by designer can be deployed across a site collection only not beyond that.

- These workflows automatically deployed into SharePoint.

- Visio can be used to model workflow logic.

- But no debugging available to step through a workflow at runtime.

- Intuitive support for forms customization.

- Workflows cannot be modified at runtime.

- Compiled just-in-time.

Visual Studio:
- Code-centric development

- Visual studio workflows supports both sequential and state machines.

- These workflows deployable across entire farm via a feature.

- Must be packaged within a feature and deployed by a farm administrator or in a sandbox.

- No support for Visio.

- Full debugging experience available.

- Less intuitive InfoPath integration. Availability for ASP.NET custom forms.

- Workflows can be modified while running.

- Compiled at design time.

Correlation ID in SharePoint 2010

Correlation ID in SharePoint 2010




SharePoint 2010 maintains logs in different areas. So it is very difficult to find what exactly the error is. But SharePoint provides a id which is known as correlation ID which is nothing but a GUID that is assigned to each conversation a user does or a SharePoint process does.

A site collection administrator can take the correlation id and search in the trace log to know where exactly the error occurred.

Just to remember for each entry in the trace log it contains a Correlation ID.

Also that entry contains the correlation id and some meaningful error message.

The correlation ID is exposed when an error page is displayed, and throughout the trace logs

Tuesday, July 16, 2013

CHECK YOUR PROVIDENT FUND ACCOUNT PF BALANCE ONLINE

CHECK YOUR PROVIDENT FUND ACCOUNT PF BALANCE ONLINE

The Employee's Provident Fund (PF) Contribution along with the Employer's Provident Contribution Amount Deducted from Your Salary Every Month is deposited in the Provident Fund account with Employees Provident Fund Organisation (EPFO).

The Employees Provident Fund Organisation (EPFO) provides a facility online to check your PF balance with the status of the account.This facility is available to the organizations who manage their PF with EPCO. The information is not available for the organisation's who have their own private PF trust

Steps To Check Your PF Balance Available with EPCO

  1. Visit The EPCO Website 
  2. Select your State
  3. Select Your EPCO Office
  4. Enter Your PF Account Details :
  • State - 2 Characters - Auto Filled after Selection
  • City  - 3 Characters - Auto Filled after Selection
  • Establishment Code - Maximum of 7 Characters
  • Extension Code - Maximum 3 Characters
  • Your PF Account Number - 7 Characters
          Eg. PF Account No. is MH/THN/12345/67   :  
          STATE - MH,
          CITY - THN
          ESTABLISHMENT CODE - 12345
          EXTENSION - 000 (leave blank)
          PF Account - 67.
  • Enter Name as in Pay Slip
  • Enter Your Mobile Number (Working as SMS would be sent on this number)
  • Select the tick mark to Agree the information provided
  • Select Submit for completing your request.
  • You would receive the SMS in a few minutes with your account details

Update or edit status filed in JIRA issue

the status field is a special case and can't be updated directly, which is the second problem here. Changing a status in Jira is called ...