Friday, August 30, 2013

Create update Delete list item using SharePoint 2013 object model

Here we will see how we can create a list item using SharePoint 2013 client object model. Also you can check:

- Create list using SharePoint 2013 client object model

- More ways to share documents or sites in SharePoint 2013

- SharePoint 2013 Developer Site Template

Here is the full code:
ClientContext context = new ClientContext("http://SiteURL");

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

ListItem newItem = myList.Items.Add();

newItem["Title"] = "My First Item";

newItem["Description"] = "My First item Desciption";

newItem.Update();

context.ExecuteQuery();

The above client object model code will add one item to MyCustomList.

Update a list item:

ClientContext context = new ClientContext("http://SiteURL");

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

ListItem listItem = myList.Items.GetById(1);

listItem["Title"] = "This is the new title";

listItem["Description"] = "This is the new description";

listItem.Update();

context.ExecuteQuery();

Here it will update the item whose ID=1.

Delete list item:

ClientContext context = new ClientContext("http://SiteURL");

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

ListItem listItem = myList.Items.GetById(1);

listItem.DeleteObject();

context.ExecuteQuery();

This will delete the item whose ID = 1.


Retrieve all SharePoint list in SharePoint 2013 client object model

Here we will retrieve all SharePoint list's using SharePoint 2013 client object model. Also check:

- Update website properties in SharePoint 2013 client object model

- New Feature in SharePoint 2013:Spelling Correction

- Create workflow using SharePoint designer 2013 in SharePoint 2013

Below is the full code:

ClientContext context = new ClientContext("http://SiteURL");

Web web = context.Web;

context.Load(web.Lists, lists => lists.Include(list => list.Title));

context.ExecuteQuery();

foreach (List list in web.Lists)
{
    lblSites.Text = lblSites.Text + ",  " + list.Title;
}

This will return all the SharePoint lists.


Update website properties in SharePoint 2013 client object model

Here we will see how we can update website properties in SharePoint 2013 client object model. Also you can check:

- Create SharePoint website using SharePoint 2013 client object model

- Hosting options in SharePoint 2013

- Create workflow using SharePoint designer 2013 in SharePoint 2013

Below is the full code:

ClientContext context = new ClientContext("http://SiteURL");

Web web = context.Web;

web.Title = "Title of New Site";

web.Description = "This is our new description for the site";

web.Update();

context.ExecuteQuery();

ExecuteQuery() method will execute the query in the server.


Get current user email by using SharePoint 2013 object model

Here we will write sharepoint 2013 object model code to retrieve current user email id. Also check out:

- SharePoint 2013 Boundaries and Limits

- PDF file support in SharePoint 2013

- What's new in workflow in SharePoint Server 2013?

Below is the code:

string strUserName = HttpContext.Current.User.Identity.Name.ToString();

string strEmail = SPContext.Current.Web.AllUsers[strUserName].Email;

First we will retrieve the user name and then we will retrieve the email id.


Retrieve selected properties of website using SharePoint 2013 client object model

Here we will check how we can retrieve selected properties of website like title and description using SharePoint 2013 client object model. Also you can check:

- New for visual webpart for SharePoint 2013 and Visual Studio 2012

- eDiscovery in SharePoint Server 2013

- What's new for mobile devices in SharePoint 2013 ?

Below is the full code:

ClientContext context = new ClientContext("http://SiteURL");

Web web = context.Web;

context.Load(web, w => w.Title, w => w.Description);

context.ExecuteQuery();

lblTitle.Text = web.Title;

lblDescription.Text = web. Description;

Here the code will give you title and description of the website. If you want to retrieve anyother properties apart from Title and Description, it will give an exception because you only load these 2 properties to context object.

context.Load(web, w => w.Title, w => w.Description);


Create SharePoint website using SharePoint 2013 client object model

Here we will discuss how to create SharePoint website using SharePoint 2013 client object model. Also check:

- Get UserProfile using SharePoint 2013 object model

- New feature in SharePoint 2013 event receivers

- Audio and Video content type in SharePoint 2013

Below is the full code that will create a new SharePoint website:

ClientContext context = new ClientContext("http://SiteURL");

WebCreationInformation webCreationInfo = new WebCreationInformation();

webCreationInfo.Url = "MyTestWebSite";

webCreationInfo.Title = "My Test WebSite";

webCreationInfo.Description = "This is our new test web site created from client object model in SharePoint 2013";

Web newWeb = context.Web.Webs.Add(webCreationInfo);

context.Load(newWeb, w => w.Title);

context.ExecuteQuery();

String newWebTitle = newWeb.Title; 


Tuesday, August 27, 2013

Change default error and successful message in infopath 2013

In infopath 2013/2010 if any error comes while submission then the default messages comes as "The form cannot be submitted because of an error.". And if the form submitted successfully then the default messages comes as "The form was submitted successfully.". But these messages we can change and we can show different error message to users. Also check
- Create workflow using SharePoint designer 2013 in SharePoint 2013

- Advantages of SharePoint Apps

- What's new in Developer dashboard in SharePoint 2013?

To change the message, first open Infopath 2013/2010, then from the Ribbon Select Submit Options from the DATA tab. This will open the Submit Options dialog box. In the dialogbox:

- First select the checkbox, "Show this message if the form submission fails" and write what ever message you want in the textbox.

- Then select the checkbox, "Show this message if the form is submitted successfully:" and write what ever message you want in the textbox.

Now click on Ok. Check the figure below:
After this the modified message will be shown to the user.


Sunday, August 25, 2013

SharePoint 2013 certification

SharePoint 2013 certification:

1- 70-331  [Core Solutions of Microsoft SharePoint Server 2013]

You can register with Prometric center to appear the exam.

The price is around $80.00 USD.

2- 70-332   [Advanced Solutions of Microsoft SharePoint Server 2013]

You can register with Prometric center to appear the exam.

The price is around $80.00 USD.


Hosting options in SharePoint 2013

In this post we will discuss about various hosting options in SharePoint 2013. Also you can check out my previous posts on:

- Create Search Service Application in SharePoint 2010

- Advantages of SharePoint Apps

- Create workflow using SharePoint designer 2013 in SharePoint 2013

SharePoint 2013 app model 2 types of hosting options which will replace SharePoint 2010 sandboxed solutions and farm solutions. The 2 app hosting options are:
- SharePoint hosted app
- Cloud-hosted apps

- SharePoint hosted app:
The SharePoint-hosted app is an app manifested inside of SharePoint and lives only inside of SharePoint. With a SharePoint-hosted app, there is no code running on the server, all code must run in the client.

A SharePoint-hosted app is effectively an .aspx page full of JavaScript.

- Cloud-hosted apps:
Cloud-hosted apps are actually any app hosted outside of the SharePoint server. This can be hosted in local IIS server in the same data center. Cloud-hosted apps enable server-side code that communicates with SharePoint.

Cloud-hosted apps provides two distinct deployment methods:
- The provisioner hosted app
- The Azure auto-hosted app

- The provisioner hosted app:
The provisioner-hosted app enables the developer to defi ne his own infrastructure, regardless of whether this infrastructure is a local server or a cloud service provider such as Amazon.com or even Azure.

Provisioner-hosted app deployment model contain additional servers are required to meet the needs of the SharePoint environment.

- The Azure auto-hosted app:
An Azure auto-hosted app is an app created in SharePoint that includes a web project and a SQL project. When the app is installed from either of the two market places, the app's web deployment manifest is automatically delivered to Azure, which automatically and invisibly provisions an Azure website service and an optional Azure SQL database instance. The application's back-end infrastructureand server-side code is completely abstracted away from the developer and the user.


Advantages of SharePoint 2013 Apps

Here in this post we will discuss about advantages of SharePoint Apps. Also you can check out my previous posts:
- Create workflow using SharePoint designer 2013 in SharePoint 2013

- Security Features in SharePoint Online

- Three tiers architecture in SharePoint 2013

Here are some advantages of SharePoint 2013 Apps:

- Apps are self-contained and independent of SharePoint server deployments. Any SharePoint environment can install and host an app without worrying about farm deployments or administrator approvals.

- Apps reduce platform risks, freeing the platform from worrying about app-based customizations during service packs and updates. Because the app is effectively an external web application running in an iFrame, SharePoint doesn’t need to worry about putting customizations at risk when an approved Microsoft service release makes changes to the server.

- Apps are deployed by default to isolated subsites within a specialized domain. This domain
isolation leverages modern web browser technologies to prevent cross-site scripting attacks,
whereas the external hosting model prevents unauthorized or incorrectly written code from
executing on the SharePoint server.

- Apps are designed to support multitenant installations. The site administration-controlled
approach to installing and managing functionality eliminates unintentional farm-level customizations, allowing numerous distinct tenants to occupy the same farm.

- Apps lower the bar for developers by supporting any web technology that can emit HTML,
CSS, and JavaScript. This includes any flavor of ASP.Net, Java, Ruby, PHP, CoffeeScript,
TypeScript, and more.


Wednesday, August 21, 2013

Create workflow using SharePoint designer 2013 in SharePoint 2013

In this post we will discuss how we can create a SharePoint 2013 designer workflow in SharePoint 2013. Also you can check out my previous posts on:
- Enable Disable developer dashboard in SharePoint 2013

- What BCS can do in SharePoint 2013?

- Set item level permission in SharePoint list

Here we will see how we can create a list workflow in SharePoint 2013. Follow below steps:

Step-1:
Open SharePoint site in SharePoint designer 2013. For this go to Start -> All Programs -> Microsoft Office 2013 -> SharePoint Designer 2013.

Then in the start page, click on Open Site and enter the SharePoint 2013 site url. Then click on Open to open the SharePoint site.

Step-2:
From the Navigation pane click on Workflows and then from the Ribbon select the particular list from the  List Workflow dropdown.

Step-3:
Then it will open the Create List Workflow dialog box. There enter a name and description for the workflow and select SharePoint 2013 Workflow in the Platform Type.

Step-4:
Then click on Ok. This will create the workflow.

Then from the Ribbon you can add whatever action or condition you want to add.


Workflow activity in SharePoint 2013

In this post we will discuss about various workflow activity in SharePoint 2013 workflow. Also you can check my previous posts on:

- What's new in workflow in SharePoint Server 2013?

- Meeting workspace removed in SharePoint 2013

- OAuth in SharePoint 2013

There are various category for these activity and each category contains some activity.
Category Name: Condition
Activity:
- CreatedBy
- ModifiedBy
- WordsInTitle etc.

Category Name: Event
Activity:
- WaitForFieldChange
- WaitForItemEvent
- WaitForCustomEvent etc

Category Name: List
Activity:
- CheckInItem
- CheckOutItem
- CopyItem
- CreateListItem
- DeleteListItem etc

Category Name: Task
Activity:
- CompositeTask
- SingleTask

Category Name: User
Activity:
- IsValidUser
- LookupSPGroup
- LookupSPGroupMembers etc

Category Name: Utility
Activity:
- Email
- GetCurrentItemGuid
- GetTaskListId etc

For full details check this msdn article.


Twitter Delicious Facebook Digg Favorites More