Quick Win – Contribute No Delete

win

Hello everyone.

Today I will talk about a specific configuration of the permissions

Problematic

As an administrator of my site,

I want my members to be able to add files / items but not to be able to delete them

In order to avoid unwanted deletion of information.

Reason

The standard permission level for members is “Edit”. This level of permission is sometimes replaced by the lower level “Contribute”. These rights allow members to participate in the addition of information to the site but also by default to delete the content.

Contribute no delete (1)

Resolution

To resolve this issue, we will create a new permission level that we will call “Contribute – No Delete”. We will apply it to the member group at the site level.

Go in the site settings

Contribute no delete (2)

Under “Users and Permissions”, click on “Site Permissions”

Contribute no delete (3)

On the ribbon, click on the “Permission Levels” links

Contribute no delete (4)

Choose the permission level “Contribute”

Contribute no delete (5)

Scroll down and click on the “Copy Permission Level” button

Contribute no delete (6)

Add the name “Contribute – No Delete”, set a description and untick the “Delete Items” and “Delete Versions” permissions

Contribute no delete (7)

Scroll down and click on “Create”

Contribute no delete (8)

The permission level is created, go back to the “Site Permission” by clicking the “Permissions” link

Contribute no delete (9)

Select the “Members” group and click on “Edit User Permissions”

Contribute no delete (10)

Select only the “Contribute – No Delete” permission level and click on ok

Contribute no delete (11)

Now your members will see this in the ribbon when they select an item

Contribute no delete (12)

“Edit item” is accessible but “Delete Item” is greyed out.

Hoping it helps.

Christopher.

Alert mail not received

SP2013


Hello everyone,

Today I’ll talk about a problem that may occur when you set alerts for users.

The error in question is the fact that the user receives the mail saying that an alert was created for him, but he is not receiving alerts generated by adding / modifying element.

One reason could be found if you configure the log to “Verbose” for the “Alert” category.

To configure the logs level, follow this procedure:

  • Go to the central administration
  • Click on the “Monitoring
  • In the “Reporting” section, click on the link “Configure diagnostic logging
  • In the “Event throttling” section, just expand the “SharePoint” section and select “Alerts
  • In the dropdown “Least critical event to report to the track log” choose “Verbose
  • Click ok

Note: This operation does not cause recycle or IISRESET, it can be done live on production farm. By cons when you have finished your test, be sure to return to the previous configuration state (choosing “Reset to default” from the dropdown list, failing which your log files grow very large).

 

This configuration will allow you to see such entries

“Alert for Immediate subscription {GUID}, event ID, USERNAME succeeded permissions check”

If instead you see such entries

Alert for Immediate subscription {GUID}, event ID, user USERNAME failed permissions check

You have your culprit!

Indeed, when sending an alert, a test is made in advance to find out whether the user can log in to the site! If you have not yet given access to the user, although it will receive the email telling him that an alert was created for him, he will not receive the actual alerts!

 

Hope this helps,

Christopher.

Disable column content edition

SP2013


Hello everyone,

Today I will talk about a sometimes requested feature : prevent change a field in a SharePoint list in edit mode.

If prevent the display of a field in the edit mode of a list can be easily done via PowerShell, do not forget that users can go through the “Quick Edit” mode of the list and bypass this configuration.

To completely prohibit the modification of a field after the creation of the item, you have to go through these two steps: Do not display the field in edit mode field and disable the DataGrid view.

If the second part can be done via the “List settings” menu of the list, the first requires a little development (PowerShell script or Visual Studio Development).

PowerShell is faster to set up, so here is the script to perform those two actions:

Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue

$siteUrl=”Site url”

$ListUrl=”List relative url”

$columnName =”Column Name”

$web = Get-SPWeb -Identity “$siteUrl”

$list = $web.GetList($web.Url + $ListUrl)

$list.Fields[$columnName].ShowInEditForm=$false

$list.Fields[$columnName].Update()

$list.DisableGridEditing=$true

$list.Update()

$web.Dispose()

 

Hope this helps

Christopher

Get Correlation ID

SP2013

 

Hello everyone,

Today I will talk about a piece of interesting code to retrieve the current correlation id. It’s not that I find the SharePoint error screen ugly (umm .. in fact yes), but from an aesthetic point of view, it may be interesting to present the error in a more “corporate” way.

public static class Helper{

       [DllImport(“advapi32.dll”)]

       public static extern uint EventActivityIdControl(uint controlCode, ref Guid activityId);

       public const uint EVENT_ACTIVITY_CTRL_GET_ID = 1;

       public static Guid GetCurrentProcessGuid()

       {

           var g = new Guid();

           EventActivityIdControl(EVENT_ACTIVITY_CTRL_GET_ID, ref g);

           return g;

       }

   }

 

PS: I am not the original author of the code, if he sees this post, thank you!

Hope this helps.

Christopher.

Multiple Upload Disabled

SP2013


Hello everyone,

Today I’ll talk about an issue with multiple upload on document library.

Sometimes this option is not available, no one knows exactly why!

If this happens, I suggest you first take a look at the following article, which lists several possible reasons:

http://sharepointknowledgebase.blogspot.com/2013/09/upload-multiple-documents-is-disabled.html#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Cdrefresh%2Cerefresh%2Conload&id=I0_1411547507947&parent=https%3A%2F%2Fwww.blogger.com&pfname=%2Fnavbar-iframe&rpctoken=61109989

 

You can also take a look at this one: http://social.technet.microsoft.com/wiki/contents/articles/11234.sharepoint-2010-how-to-enable-uploading-multiple-documents-functionality.aspx

 

However, sometimes this option is grayed out only for some users and / or at certain locations. If this happens, take a look at the permissions!

To see the advantage of multiple upload, it is necessary that the user has the following permission

« Use Client Integration Features – Use features which launch client applications. Without this permission, users will have to work on documents locally and upload their changes.

 

Hope this helps!

Christopher

Customize Content Editor Webpart

SP2013


Hello everyone,

Today I’ll do a little advertising for 2 articles which particularly helped me recently.

My task was to use the “content query web part” to display the tasks assigned to the current user in the current site collection.

Of course, the rendering should be customized to look like as closely as possible to the traditional list view in SharePoint.

For this issue, I am confronted with three challenges.

1) Rendering

During the design of my xsl, I’ve realized that the “content query web part” displays items as “BulletList” not very practical when you want to display a table.

To change the rendering of “content query web part,” I have followed this excellent post from Waldek Mastykarz: http://blog.mastykarz.nl/optimizing-output-content-query-web-part/

2) Show the presence indicator

In my view, I wanted to see the person who created the task as well as the presence indicator. Order to display this, I followed the advice of this post: http://www.sharepointcolumn.com/lync-presence-indicators-code-snippets-in-sharepoint-2013

3) Display the contents of the “Assigned To” field

For this point, a constraint is imposed on me; the fields allowing multiple values are not roll up by the content query webpart! Order to display the “Assigned to” field, the field should be changed to allow only one value.

 

Thank you to the authors of the two articles mentioned!

 

Hope this help.

Christopher

 

 

Remove orphaned feature

SP2013


Hello everyone,

Today I’m going to talk about a problem that can happen in a development phase.

When you test your solutions, you may find yourself confronted with this kind of error when deploying:

Sorry, something went wrong

A feature with ID 15/{GUID} has already been installed in this farm. Use the force attribute to explicitly re-install the feature.

First of all, you can delete the feature using this PowerShell command

$feature = Get-SPFeature | ? { $_.Id -eq “{GUID}” }

$feature.Delete()

If you want to do some prevention, you can also run this one which will display all the orphaned feature (meaning they was rectracted unproperly and prevent you for active them again during deployment)

Get-SPFeature | ? { $_.Scope -eq $null }

The tips to display orphaned feature comes from this post: http://sharepoint.stackexchange.com/questions/16525/how-to-remove-orphaned-features thanks to the author!

Hope this helps.

Christopher.