Friday, December 5, 2014

Hide left navigation using jQuery in SharePoint 2013

In this post we will discuss how to hide left navigation using jQuery in SharePoint 2013.

Also check out:
- Accordion Style Left Navigation using JQuery and CSS in SharePoint 2010

- Upload Excel Data to SharePoint using Import Spreadsheet option in SharePoint 2013

- HTTP Error 503. The service is unavailable error in SharePoint 2013

Put the below code in a script editor web part or content editor web part.

<script language="javascript" type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(retrieveListItemsInclude,'sp.js'); 
function retrieveListItemsInclude()
{
document.getElementById("sideNavBox").style.display='none';
}
</script>

This will hide the left navigation from the page.


How to create subsite in SharePoint 2013?

To create a sub site in SharePoint 2013, we need to follow below steps:

Click on the Settings icon from the top right corner. Then go to Site Contents, this will open the site contents page.

Here go down to the Subsites section and click on
.

In the New SharePoint Site page, give a Title, Description and the Web Address.

Then choose the Template, here we have choosen Team site.

If you want the subsite to use the same parent site permission, then in the Permission section select Use same permission as parent site.


Then click on Create this will create the sub site.


Wednesday, December 3, 2014

How to give item level permission in SharePoint 2013 list items?

We will discuss how we can provide item level permission to list or document library items in SharePoint 2013. Through this item level permission, we can define unique permission to that particular item.

In this sample, I have a list name as TestList1 and I want to give item level permission to one of the list items. First, open your list in the browser and then select the particular list item and then click on ... like below:

Read Microsoft Flow Step by Step Tutorial with Examples


This will open the menu, click on "Shared With" as shown in the fig below:


In the Shared With dialog box, it will display to whom the item has been shared. Click on ADVANCED as shown in the fig below:


This will open the PERMISSIONS page. Each item has a permission of the parent by default. To give unique permission we need to Stop inheriting permission from the parent and then we can give unique permission to the item. So click on "Stop Inheriting Permission" as shown in the fig below:


If you are using chrome browser, then Stop Inheriting Permission will come under PERMISSIONS -> Inheritance -> Stop Inheriting Permissions like below:


Then this will display a message saying you are about to create unique permission for this item... Click on OK.

Now you can give permission by clicking on the Grant Permission button from the Ribbon or you can select any group and click on Edit User Permissions if you want to modify any user permissions as shown in the fig below:


Similarly, if you want to remove permission for any particular group, then you can select the group and click on Remove User Permissions. It all depends on your need.

Revert Back:
Now if you want to revert back and want to inherit permission level from the parent then simply click on Delete unique permissions as shown in the fig below:


Then it will ask for a confirmation message that you are about to inherit permission from the parent... Click on OK.


SharePoint 2013 Add item to list using JavaScript client object model

In this post we will discuss how to add an item to SharePoint 2013 list using JavaScript object model. In this example we will provide an option for user to enter the title for the item and user can click on the button to save the item.

In my previous post we have discussed about: SharePoint 2013 Disable Windows Authentication prompt, Search Engine Optimization in SharePoint 2013 and New action in SharePoint designer 2013 workflow.

I have a SharePoint list and I want to insert item to that list. We will write the code in a script editor web part.

<script type="text/javascript">
function insertitemtolist()
{
var title=document.getElementById('txtTitle').value;
var clientContext = new SP.ClientContext("http://win-pfcp2dgt8di/sites/EnjoySharePoint/");
var oList = clientContext.get_web().get_lists().getByTitle('TestList1');
var item = new SP.ListItemCreationInformation();
var oListItem = oList.addItem(item);
oListItem.set_item('Title', title);
oListItem.update();
clientContext.load(oListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
</script>
Enter Item Title: <input type="text" id="txtTitle" /> <br/><br/>
<button type="button" onclick="insertitemtolist();">Insert Item To List</button>

Hope this will help you !!!


Twitter Delicious Facebook Digg Favorites More