..:: I like SharePoint ::.. Rotating Header Image

Template

SharePoint list schema force checkout & checkin

If you creating a list definition and you want the list to force the user to checkin & checkout listitems, you can do this by adding this attribut ForceCheckout=”True”

You put it in the <List> tag at the beginning. It will say that it is not declared attribute, but it will work. Try it yourself.

 

..:: I LIKE SHAREPOINT ::..

SharePoint Create custom permission levels and groups with c#

You can use custom code to create your own permission level and custom groups in SharePoint. Usage is mostly a feature which user can activate or if you are using a site definition it would be used to provide custom groups and permission levels to a specific site template at creation time.

Let’s see what we have to do in code? This code could be implemented in a feature event receiver.

Create Permission Level

At first we create the permission level. There are two ways. You can use a default or a already existing permission level. In the second part you see how to generate your own permission level.



//Get default permission level
SPRoleDefinition roleDefAdmin = web.RoleDefinitions.GetByType(SPRoleType.Administrator);

//Create a new permission level
SPRoleDefinition roleDefContributeNoDelete = new SPRoleDefinition();
roleDefContributeNoDelete.Name = "Contributor Permissions without Delete";
roleDefContributeNoDelete.Description = "Mitwirken ohne Löschen";
roleDefContributeNoDelete.BasePermissions = SPBasePermissions.AddListItems | SPBasePermissions.EditListItems
| SPBasePermissions.ViewListItems | SPBasePermissions.OpenItems | SPBasePermissions.ViewVersions | SPBasePermissions.CreateAlerts
| SPBasePermissions.ViewFormPages | SPBasePermissions.ViewPages | SPBasePermissions.BrowseUserInfo
| SPBasePermissions.UseRemoteAPIs | SPBasePermissions.UseClientIntegration | SPBasePermissions.Open;

rootWeb.RoleDefinitions.Add(roleDefContributeNoDelete);


If you now deploy your permission level should be available.

Create Group and assign permission level

In these steps we create a group and assign the permission level to the group.



//create group
rootWeb.SiteGroups.Add("Meine Gruppe", site.Owner, site.Owner, "Beschreibung");
//get the created group from web
SPGroup groupAdmin = rootWeb.SiteGroups[groupname];
//Create a new assignment and afterwords, bind the group to it. Then set the roledefinition (permission level) to it and add it to the web.
SPRoleAssignment roleAssignAdmin = new SPRoleAssignment(groupAdmin);
roleAssignAdmin.RoleDefinitionBindings.Add(roleDefAdmin);
rootWeb.RoleAssignments.Add(roleAssignAdmin);
rootWeb.Update();


Now if you look at site actions – site permissions your group should be displayed with the permission level we assigned.

..:: I LIKE SHAREPOINT ::..

 

SharePoint 2010 How to hide the recycle bin and the all site content links

Sometimes you wish that your users or the users of your customer could not click or see the links like recycle bin and all site content.You can deactive the recycle bin or set permissions to not see the all site content, but what if that does not fit to the rest of your SharePoint Site? What if you do not want to deactivate it?

Well, it is not that difficult as you might expect.

Step 1: Add a Content Editor Webpart to your site

you can also add the css-stylesheet for the class in master page or your custom css file. But then it will hide the recycle bin and the link all site content on each page. So if you only want to hide these on a certain page it would not help to put it into the masterpage.

This css code changes / overwrites the original css file. After that you can hide the content editor webpart, so that the user won’t see your trick :) (more…)

SharePoint 2010 How to hide the Quicklaunch Bar

In my other post i described how to ide the recycle bin and the all site content link. Now i give you a short explanation how to hide the quicklaunch bar.

It is very the same as the recycle bin. You put the following lines of css in a Content Editor Webpart or in SharePoint Designer in a page or the masterpage or the overwrite the css file of SharePoint – depend on what you wnat. If you want to hide the quicklaunch at all sites the master or css file of SharePoint might be the right place. If you like to hide the bar only at one page, the CEWP would be the choice for you.

Use these lines of css



/*--Hide Quick Launch --*/
#s4-leftpanel{
display:none
}
.s4-ca{
margin-left:0px
}


And your website look like this:

You could also just create a new page from page layout. The Quicklaunch bar is there not available. If you like to get the Quicklaunch bar there look at this post.

..:: I LIKE SHAREPOINT ::..