When I was using the contributor account to check the content-type folder is "message" or "Dicussion", I got an error: "Access denied!"
My code:
if (ctype.ResourceFolder.Name == "Message")
{
//do something
}
But nothing happened with owner account.
Yes, because contributor account can not access to ResourceFolder properties of content-type. ResourceFolder was inherited from SPFolder and execute the method FolderEnsure. You know to give the access to folder ensure the account must be set the properties currentWeb.AllowUnsafeUpdates = true; and the default for member account does not have permission to run that update.
You can change the code to look like this:
if (ctype.Id == SPBuiltInContentTypeId.Message)
{
//do something
}
The result is nearly the same.
Showing posts with label ContentType. Show all posts
Showing posts with label ContentType. Show all posts
Sunday, February 13, 2011
Friday, September 17, 2010
Redirect to link to new item with ContentType in SharePoint 2010
If you are working on SharePoint 2010 with Ribbon Menu, you will never see the action of each item menu on Ribbon. Thus, it's a little bit difficult to get the link or the JavaScript function to redirect to the target of action. This topic will describle the links of new item in ContentType.
In SharePoint 2010 has a lot of ContentTypes defined for List and library, if the name of contenttype has one of these value:
Basic Page: /_layouts/bpcf.aspx?List={YOUR_LIST_ID}&RootFolder=YOUR_ROOT_FOLDER &ContentTypeId=ITEM_CONTENTTYPE_ID&Source=URL_RETURNS
Web Part Page: /_layouts/spcf.aspx?List={YOUR_LIST_ID}&RootFolder=YOUR_ROOT_FOLDER &ContentTypeId=ITEM_CONTENTTYPE_ID&Source=URL_RETURNS
Master Page: (or)
Picture:
javascript:NewItem2(event,"/_layouts/upload.aspx?List={YOUR_LIST_ID} &RootFolder=YOUR_ROOT_FOLDER &ContentTypeId=ITEM_CONTENTTYPE_ID&Source=URL_RETURNS&IsDlg=1");
In SharePoint 2010 has a lot of ContentTypes defined for List and library, if the name of contenttype has one of these value:
Basic Page: /_layouts/bpcf.aspx?List={YOUR_LIST_ID}&RootFolder=YOUR_ROOT_FOLDER &ContentTypeId=ITEM_CONTENTTYPE_ID&Source=URL_RETURNS
Web Part Page: /_layouts/spcf.aspx?List={YOUR_LIST_ID}&RootFolder=YOUR_ROOT_FOLDER &ContentTypeId=ITEM_CONTENTTYPE_ID&Source=URL_RETURNS
Master Page: (or)
Picture:
javascript:NewItem2(event,"/_layouts/upload.aspx?List={YOUR_LIST_ID} &RootFolder=YOUR_ROOT_FOLDER &ContentTypeId=ITEM_CONTENTTYPE_ID&Source=URL_RETURNS&IsDlg=1");
Link to a Document:
javascript:NewItem2(event,"/_layouts/NewLink.aspx?List={YOUR_LIST_ID} &RootFolder=YOUR_ROOT_FOLDER &ContentTypeId=ITEM_CONTENTTYPE_ID&Source=URL_RETURNS&IsDlg=1");
List View Style:
Dublin Core Columns:
javascript:EditItem2(event,"/_layouts/Upload.aspx.aspx?List={YOUR_LIST_ID} &RootFolder=YOUR_ROOT_FOLDER &ContentTypeId=ITEM_CONTENTTYPE_ID");
Summary Task:
New Folder:
New Item:
javascript:EditItem2(event,"/_layouts/listform.aspx?ListId={YOUR_LIST_ID} &RootFolder=YOUR_ROOT_FOLDER &ContentTypeId=ITEM_CONTENTTYPE_ID");
Report Builder Model:
javascript:CoreInvoke('createNewDocumentWithRedirect2', event, '/_layouts/ReportServer/NewReportBuilderModel.smdl','YOUR_ROOT_WEB', 'SharePoint.OpenSmdlFiles', false,'/_layouts/ReportServer/GenerateModel.aspx?RelativeModelUrl= /_layouts/ReportServer/NewReportBuilderModel.smdl',false,1)
Report Data Source:
javascript:CoreInvoke('createNewDocumentWithRedirect2', event, '/_layouts/ReportServer/NewSharedDataSource.rsds','YOUR_ROOT_WEB', 'SharePoint.OpenRsdsFiles', false,'/_layouts/ReportServer/SharedDataSource.aspx?RelativeDataSourceUrl= /_layouts/ReportServer/NewSharedDataSource.rsds',false,1)
Report Builder Report:
javascript:CoreInvoke('createNewDocumentWithRedirect2', event, '/_layouts/ReportServer/rs.rsapplication', 'YOUR_ROOT_WEB', 'SharePoint.OpenRdlbFiles', false, '/_layouts/ReportServer/RSAction.aspx?RSAction=ReportBuilder&FileUrl=/_layouts/ReportServer/rs.rsapplication', false, 1)";
Note: YOUR_ROOT_WEB is the root web, ex: http://servername or http://servername:8080
Hope to waiste the less time to find out them.
Subscribe to:
Posts (Atom)
