Click here to Skip to main content
15,886,570 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Error-The control is not available because you do not have the correct permissions
i have custom web part in sharepoint
It have people picker
it will only working when i sign in into my user account
if i sign out from user account, it show the following error

Error-The control is not available because you do not have the correct permissions
ASP.NET
<SharePoint:PeopleEditor  runat="server" ID="txtuser" AllowEmpty="True" MultiSelect="False" PrincipalSource="Windows" SelectionSet="User" Width="300px" Height="20px" ErrorMessage="Select Valid User" ShowCreateButtonInActiveDirectoryAccountCreationMode="true"/>


C#
PickerEntity mypicker = (PickerEntity)txtuser.Entities[0];
                           string username = mypicker.DisplayText;
                           SPUser users_applied = myweb.EnsureUser(username);
                           SPFieldUserValue fuv_applied = new SPFieldUserValue(myweb, users_applied.ID, users_applied.Name);
Posted

1 solution

Make sure you have imported following reference

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
C#




I have used it like following

SQL
<SharePoint:PeopleEditor runat="server" ID="ppl1stApprover" IsValid="true" AllowEmpty="false"
                    MultiSelect="false" Width="300px" />


and

C#
<pre lang="c#"><pre lang="c#">
C#
person = (PickerEntity)ppl3rdApprover.ResolvedEntities[0];
                    thirdApprover = SPContext.Current.Web.EnsureUser(person.Key);
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900