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");


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.

2 comments:

Nguyễn Tuấn Hải said...

Note: with the string contains "javascript", that means it will show the popup to new item and another must be redirected to the page.

Julia said...

Thank you very much, quite helpful.