Skip Ribbon Commands
Skip to main content
Mai Omar Desouki > SharePoint 2010
May 03
Dynamic Item Permissions from SharePoint Designer Workflow

Dear all, this post is for Willy Vidable for thread in MSDN and its idea is by Clayton​, and i am doing a step by step for Willy to help much better and also i wanted to post that workflow as i find it useful for all of us to use.

Step 1:

Create a custom list, you will have Column named Title by default, created another column named Assign to of type people and group.

and that's it for the list.

listcol.PNG

Step 2:

Open your site in SharePoint Designer, click on workflow on the left navigation,

from ribbon on top, click list workflow, and choose your custom list you just created,

to list workflow.png

First put your mouse out of Step 1, and insert Impersonation Step, then remove Step 1 as we don't need it

impersonation.PNG

It should look like this:

impersonationadded.PNG

Now put your mouse inside the Impersonation Step as this will make you see More Actions,

click on Action from ribbon, and under list category > click Replace item permission

replace.png

Click on these permissions link, and click add, then click choose, don't check on any check box of those permissions now,

we will come to it later, from Select users windows > click Workflow Lookup for a user, click add, keep datasource to current item,

from field from source, we will choose the Assign to column that we created in our custom list, now click ok till you reach to

the Add permissions windows, from here, based on your needs, choose the permission you want to give to the user,

who will work on the item created for him/her.


thesepermissions.PNG

I choosed Contribute, but choose what suites you.

contribute.PNG

The second link is this list, we will choose the default, keep it current item.

impoersonationok.PNG
Now save and publish, you will see the display message, give it ok, this is because of the impersonation step.

Now go to your site in the browser, and to our custom list, create new item, type in the assign to column,

the user who should have permissions on this item. and click the item, and from the ribbon choose Worflows, or

from the dropdown menu on the item title, or from dialog when you open the item,... more than one way..

you will see your workflow name that you created, click on it and click on start.

startwf.PNG


Now you should see on your custom list, that workflow completed, as we don't have much steps, its only one.

you can add more based on your needs.

 

If you go now to see this item permission, you see it is not inherting anymore, but it has unique permissions and

and user you wrote in assign has the permission that we chose while create SharePoint Designer workflow.


unquie.PNG

Hope that helps.

Thanks Clayton for your idea, i add this dynamic steps to it.

 

April 29
Forms Based Authentication FBA by AD in SharePoint 2010

Interesting, isn't it???

Why would you want to authenticate by your AD account from FBA while you can still do by Windowns Authentication..

Actually i didn't find a reason but i was giving SharePoint course, when a Trainee told me one reason, its better User Interface for the end user, seems that end user does not like the windows authentication... well okay

So we did this lab, but if you find more reasons why would you do it, please write a comment... :-)

So here is the steps:

First let me tell you we will edit in 3 web.config files...

1- Of our web app.

2- Central administration

3- STS Secure token Service

so lets start:

Step 1:

Go to web.config of your web app, and add those lines:

 

<membership defaultProvider="i">
      <providers>
        <add name="i" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
     
<add name="admembers"
           type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
           connectionStringName="adconn"
           enableSearchMethods="true"
           attributeMapUsername="sAMAccountName" />
 
</providers>
    </membership>
    <roleManager defaultProvider="c" enabled="true" cacheRolesInCookie="false">
      <providers>
        <add name="c" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
      </providers>
    </roleManager>

  </system.web>
 
<connectionStrings>
   <add name="adconn"
        connectionString="LDAP://crmdemo.com/DC=crmdemo,DC=com" />
</connectionStrings>
 
Note: I am highlighting </system.web> as it already exists, you will add the membership above it and below it, you will add the connection string.
 

 Step 2:

 Open Central administration web.config:

   
<membership defaultProvider="admembers">
   <providers>
      <add name="admembers"
           type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
           connectionStringName="adconn"
           enableSearchMethods="true"
           attributeMapUsername="sAMAccountName" />
   </providers>
</membership>
 
  </system.web>
 
<connectionStrings>
   <add name="adconn"
        connectionString="LDAP://crmdemo.com/DC=crmdemo,DC=com" />
</connectionStrings>

Note: I am highlighting </system.web> as it already exists, you will add the membership above it and below it, you will add the connection string.

 

 Step 3:

 Now we add the same to STS Secure Token Service web.config,

To open it, open IIS 7 or if you have win 2008 R2 then your IIS is 7.5, anyway in both it is same steps:

sts1.PNG

Right Click on it and click explore, there are 3 files, we only want the web.config: now to the end of web.config

 after </system.net> we will add the connection string:

</system.net>

<connectionStrings>
   <add name="adconn"
        connectionString="LDAP://crmdemo.com/DC=crmdemo,DC=com" />
</connectionStrings>
 
 
<system.web>  there was not system.web but we will add it
 
<membership defaultProvider="admembers">   
<providers>
<add name="admembers"
           type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
           connectionStringName="adconn"
           enableSearchMethods="true"
           attributeMapUsername="sAMAccountName" />
</providers>
</membership>
 
</system.web>

</configuration>

 

 ...... Last but not least :-)

This depends: if you created your web app. and kept the default selection of Classic Authentication selected, then we need to convert it to use Claims, to do this, Open SharePoint PowerShell an write the following:

$w = Get-SPWebApplication http://servername:port
$w.UseClaimsAuthentication = "True";
$w.Update()
 

before this PS, go to CA > manage web app > select your web app and from ribbon > click Authentication provider >

 dimmedforms.PNG

You will see Forms dimmed, after the PS command it will be enabled, and you can write your membership name as it was in web.config, and as below.....

membershipinca.PNG

Now try.... yes try it, open your site, if you tried to login using FBA and wrote Administrator, you will get access denied while this is Farm administrator account....

One last Step:

we need to the administrator of FBA as Secondary administrator:

go to CA > Manage web app > click site collection administrators > in secondary:

 scadmin.PNG

There is administrator from AD and from FBA..... :-)

add it, it should be like below: add administrator and any user you want from AD.

secondary.PNG
Now try to login to your site again using Forms authentication:

FBA2.JPG




Next Post, i will tell you how to see only FBA without choosing, and still by AD account.

Good Luck, don't forget it to write comment to tell me about another reason..

 

April 29
Disable SharePoint Designer

Sure we don't want to edit in our master page everyday....

And hopefully not give this permissions to all stuff, it's Critical when it comes to playing around our master page and we don't understand it.

So SharePoint 2010 gave us new option to Shut Down SharePoint Designer.

... you can disable it from Site Owners and from Designers

by going to Site Action > Site Settings > and under Site Collection Administration > click on SharePoint Designer Settings... from here there are four options to disable and they are enabled by default.

spdsettings.PNG

the4optioninteamsite.PNG

You see the below message when you try to open your site after disabling the SPD, remember trying to open it by System Account will open, i am opening by Site Owner which is the permssions in the SharePoint Designer settings in the Site settings page.

disableSPD.PNG


Not only can you disable it from Site Owners and Designer but also from Site Collection Administrators...

From Central Administration > Manage Web Applications > and from thr ribbon click General Settings > SharePoint Designer

ca SPD.PNG

Those below options are from SharePoint Designer Settings in Central Administration

spdsettingsinca.PNG

April 27
Text Filter Web Part

This applies to both SharePoint 2007 and 2010.  In MOSS Enterprise, and the 2010 version of Enterprise.  There is an out-of-box web part called the Text Filter Web Part.  Basically, when you put this web part on a page, and put a list or library web part on the same page, you then create a web part connection that sends the text typed in the box as a filter to one of the columns in the web part, like this:
ch5[38]
The name Molly Clark had to be typed in exactly.  So, if you typed “Molly”, this record would not come up. 
People use the text filter web part when they just want to search a single column in a list or library.  Otherwise, you’d simply use the “Search” box at the top of the screen, choose “This List” or “This Site” and perform SharePoint searches that way.

 Laura Rogers doing a great solution to be able to partially filtering rather than the whole word, find more in the below link:

http://www.sharepoint911.com/blogs/laura/Lists/Posts/Post.aspx?List=676af157%2D7d96%2D4e15%2Da987%2D54b8a3e4d948&ID=85

April 20
Security Trimmed Controls in SharePoint

Let’s say you have a control on your page that you want only a certain group of users to see. Fortunately, SharePoint has a built-in control that lets you hide controls to which users do not have the necessary permissions.  This control is the SPSecurityTrimmedControl.

<Sharepoint:SPSecurityTrimmedControl runat=”server” Permissions=”ManageLists”>
Place your control(s) here
</SharePoint:SPSecurityTrimmedControl>
All you have to do is wrap your control with this security control and set the correct permissions in the Permissions attribute. The Permissions attribute, when used in Visual Studio or Designer, will have intellisense.  Whatever permissions you specify will be required by the user in order to view the control(s) inside of the SPSecurityTrimmedControl:
 
Member Name​ ​Description
EmptyMask Has no permissions on the Web site. Not available through the user interface.
ViewListItems View items in lists, documents in document libraries, and view Web discussion comments.
AddListItems Add items to lists, add documents to document libraries, and add Web discussion comments.
EditListItems Edit items in lists, edit documents in document libraries, edit Web discussion comments in documents, and customize Web Part Pages in document libraries.
DeleteListItems Delete items from a list, documents from a document library, and Web discussion comments in documents.
ApproveItems Approve a minor version of a list item or document.
OpenItems View the source of documents with server-side file handlers.
ViewVersions View past versions of a list item or document.
DeleteVersions Delete past versions of a list item or document.
CancelCheckout Discard or check in a document which is checked out to another user.
ManagePersonalViews Create, change, and delete personal views of lists.
ManageLists Create and delete lists, add or remove columns in a list, and add or remove public views of a list.
ViewFormPages View forms, views, and application pages, and enumerate lists.
Open Allow users to open a Web site, list, or folder to access items inside that container.
ViewPages View pages in a Web site.
AddAndCustomizePages Add, change, or delete HTML pages or Web Part Pages, and edit the Web site using a SharePoint Foundation–compatible editor.
ApplyThemeAndBorder Apply a theme or borders to the entire Web site.
ApplyStyleSheets Apply a style sheet (.css file) to the Web site.
ViewUsageData View reports on Web site usage.
CreateSSCSite Create a Web site using Self-Service Site Creation.
ManageSubwebs Create subsites such as team sites, Meeting Workspace sites, and Document Workspace sites.
CreateGroups Create a group of users that can be used anywhere within the site collection.
ManagePermissions Create and change permission levels on the Web site and assign permissions to users and groups.
BrowseDirectories Enumerate files and folders in a Web site using Microsoft Office SharePoint Designer 2007 and WebDAV interfaces.
BrowseUserInfo View information about users of the Web site.
AddDelPrivateWebParts Add or remove personal Web Parts on a Web Part Page.
UpdatePersonalWebParts Update Web Parts to display personalized information.
ManageWeb Grant the ability to perform all administration tasks for the Web site as well as manage content. Activate, deactivate, or edit properties of Web site scoped Features through the object model or through the user interface (UI). When granted on the root Web site of a site collection, activate, deactivate, or edit properties of site collection scoped Features through the object model. To browse to the Site Collection Features page and activate or deactivate site collection scoped Features through the UI, you must be a site collection administrator.
UseClientIntegration Use features that launch client applications; otherwise, users must work on documents locally and upload changes. 
UseRemoteAPIs Use SOAP, WebDAV, or Microsoft Office SharePoint Designer 2007 interfaces to access the Web site.
ManageAlerts Manage alerts for all users of the Web site.
CreateAlerts Create e-mail alerts.
EditMyUserInfo Allows a user to change his or her user information, such as adding a picture.
EnumeratePermissions Enumerate permissions on the Web site, list, folder, document, or list item.
FullMask Has all permissions on the Web site. Not available through the user interface.
** You can also use the PermissionsString property to use a comma seperated list.

April 17
We are hearing those days SharePoint Online..

SharePoint Online has been rebranded as Office 365 and its in public beta.. You can signup from here and get the account and try it out by yourself...

http://www.microsoft.com/en-us/office365/online-software.aspx

office365.PNG
It is not for install, think about it as SharePoint in the Cloud.

BTW - There are other providers that host SharePoint in the cloud and therefore offer "SharePoint Online" but Office 365 (formerly BPOS) is hosted by Microsoft.

And see video on Channel 9

https://channel9.msdn.com/posts/Office-365-The-power-to-think-big-and-be-small-to-be-big-and-act-fast

ch9.PNG


April 05
STUG 9th April 2011 Live Event @ SharePoint Techies User Group

Hi all, I will be speaking next Sat. 9 April @ SharePoint Techies User Group.

My session will be about SharePoint 2010 Integration with CRM 2011.

We are lining up series of Live event, and this event will be one of that Event. This event is designed for the young and experience developers, IT Pros, administrator who wants to learn about about SharePoint 2010.
 
This time we have engage three speakers from three countries, to paricipate in this exciting Webinar on Saturday 9th April2011. Each session will be of 1 hour, and the whole event will take 3 hours to complete. Webinar will start on 5:00 PM (Pakistan Standard Time) and will finish at 8:00 PM (Pakistan Standard Time). Just to note that PST= 5+GMT.
So  you need to sync your local time with our webinar, you can sync your time by looking into this site.

 

Register Here 

 

SharePoint Techies User Group.png

March 30
Start with Document Set

Hi all, Hope this helps you get started with Document Set.

first enable Document Set Feature from Site Collection Features

Now Create Document Library, and enable "Allow management of content type?" from Library Settings in Advanced Settings, then the Document Set Content Type to your library




Now you can create to Document Set

 

I created 2 Document Set in 1 Document Library






as you see from the SharePoint Tree Navigation above, "Doc Set" is the Library Name.



So this is how you start creating Document Set.

March 20
Watch out if you uninstall the PowerPivot for SharePoint

FIX: SharePoint services and SharePoint Server Enterprise Site Collection features are disabled after you uninstall the PowerPivot for SharePoint component on a computer that is running SQL Server 2008 R2

http://support.microsoft.com/kb/2269585/

March 20
SharePoint Web Part Development Tutorial [MOSS 2007]

It is hard to find out simple way to create SharePoint web parts with visual designing. After looking at custom features, in this article I'm going to show you how to create custom SharePoint web part using Web User Control in Visual Studio.

Creating the Web Part

First Create New Project called "ProjectView" and select ASP.NET Web Application (Figure 1 & 2). Don’t use shortcuts.



Then Add new Web User Control called "ProjectViewControl" to your project (Figure 3 & 4).



Then Add reference to the “Microsoft.SharePoint.dll”. It can be found in your sharepoint server’s ISAPI folder (Figure 5 & 6).



You should copy this file along with “Microsoft.SharePoint.Search.dll” and “Microsoft.SharePoint.Search.xml” from the same directory to a directory on your local computer if you are developing your project on a machine not having SharePoint or MOSS.

Then go to your SharePoint site’s folder (You can find it in SharePoint server) and create a folder called “usercontroles” if does not exist (Figure 7).


Find your site’s “Web.config” file within the same folder and open it (Figure 7).


Then add new Class called “WebControl.cs” which inherits from “WebPart” Class to your project (Figure 8) and paste this code there.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebPartPages;
  
namespace ProjectView
{
    public class WebControl : WebPart
    {
        protected string UserControlPath = @"~/usercontrols/";
        protected string UserControlName = @"ProjectViewControl.ascx";
  
        private ProjectViewControl mycontrol;
        private string exceptions = "";
  
        protected override void CreateChildControls()
        {
            try
            {
                mycontrol = (ProjectViewControl)this.Page.LoadControl(UserControlPath + UserControlName);
                Controls.Add(mycontrol);
            }
            catch (Exception CreateChildControls_Exception)
            {
                exceptions += "CreateChildControls_Exception: " + CreateChildControls_Exception.Message;
            }
            finally
            {
                base.CreateChildControls();
            }
        }
        protected override void RenderContents(HtmlTextWriter writer)
        {
            try
            {
                base.RenderContents(writer);
            }
            catch (Exception RenderContents_Exception)
            {
                exceptions += "RenderContents_Exception: " + RenderContents_Exception.Message;
            }
            finally
            {
                if (exceptions.Length > 0)
                {
                    writer.WriteLine(exceptions);
                }
            }
        }
    }
}
There don’t forget to add following two lines to the top, now your “WebControl.cs” Class should like above.

using Microsoft.SharePoint;
using Microsoft.SharePoint.WebPartPages;

Then drag and drop a text box and two buttons to ProjectViewControl.ascx. Double click those buttons to add custom code (Figure 9 & 10).



Signing your web part project

To deploy this Web Part and Web User Control to GAC and the Microsoft Office SharePoint Server, we should assign a Strong Name key and sign the control.

To do this, right click the “ProjectView” node in Solution Explorer and select Properties. Then select the Signing tab from the choices on the left. Check the "Sign the assembly" box and select from the "Choose a strong name key file" drop down list (Figure 11).

There give a key file name and click ok. Now you can build your project and ready to deploy.

Deploying the Web Part and Web User Control

Here is deploying steps;

1. Copy the "ProjectViewControl.ascx" file to the created usercontroles folder (Figure 7).

2. Drag and drop the compiled DLL (You can find it in your project folder's bin folder) into the Global Assembly Cache. The Global Assembly Cache is a special folder located at %WINDIR%\assembly where %WINDIR% is the full path to your Windows folder (e.g. C:\Windows or C:\Winnt).

3. Get the publicKeyToken property of our assembly. You can find it by right click on the file and select properties in "assembly" folder (Figure 12).


4. Update the "Web.config file"

4.1 Insert these three lines between <SafeControls> and </SafeControls> tags.
1
2
3
<SafeControl Assembly="ProjectView, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9a73871474819663" Namespace="ProjectView" TypeName="WebControl" Safe="True" />
<SafeControl Assembly="ProjectView, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9a73871474819663" Namespace="ProjectView" TypeName="ProjectViewControl" Safe="True" />
<SafeControl Assembly="ProjectView, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9a73871474819663" Namespace="ProjectView" TypeName="*" Safe="True" />
4.2 Insert this line between <assemblies> and </assemblies> tags.
1
<add assembly="ProjectView, Version=1.0.0.0, Culture=neutral,PublicKeyToken=9a73871474819663" />
5. Insert new XML file called "myprojectview.webpart" (Figure 13) and paste this code.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?xml version="1.0" encoding="utf-8" ?>
<webParts>
    <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
        <metaData>
            <type name="ProjectView.WebControl, ProjectView, Version=1.0.0.0,Culture=neutral,PublicKeyToken=9a73871474819663" />
            <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
        </metaData>
        <data>
            <properties>
                <property name="Title" type="string">My first custom Web Part</property>
                <property name="Description" type="string">
                    webpart created by using web user controles
                </property>
                <property name="ChromeType">TitleOnly</property>
                <property name="ChromeState">Normal</property>
                <property name="ItemLimit" type="int">15</property>
                <property name="ItemStyle" type="string">Default</property>
            </properties>
        </data>
    </webPart>
</webParts>
6. Upload the "myprojectview.webpart" file to Share Point's Web Part gallery. (You should have permission to see the Site Action tab and upload) (Figure 14, 15, 17, 18 & 19)






Use your Web Part

To use your Web Part in a page, follow these steps;

1. Edit a SharePoint page (Figure 19, 20 & 21)
2. Select a zone into which you want to place your Web Part
3. Add the Web Part to the zone
4. Exit from the Edit mode






Remember that you cannot copy DLL from MyDocument folder. So first copy the DLL to some location in SharePoint Server and then drag and drop it into assembly folder.

If you are interested you can try SharePoint charting (Chart inside web part) to see how you can add nice chart inside to this web part. Also try custom features.

http://sarangasl.blogspot.com/2009/09/custom-sharepoint-webparts.html

1 - 10Next
 

 Visitors

 
 

 My Recent Posts

 
  
  
  
5/3/2011 2:26 PM
  
4/29/2011 6:58 PM
  
4/29/2011 6:32 PM
  
4/27/2011 12:38 PM
  
4/20/2011 4:12 PM
  
4/17/2011 12:23 PM
  
4/5/2011 1:06 PM
  
3/30/2011 12:16 PM
  
3/20/2011 3:10 PM
  
3/20/2011 3:03 PM
  
3/20/2011 2:58 PM
  
3/8/2011 10:28 PM
  
3/5/2011 11:02 AM
  
2/25/2011 9:31 AM
  
2/20/2011 11:17 AM
1 - 15Next