views:

18

answers:

0

I have written a feature(Site scoped) that adds custom menu items to the New Menu. it will create new documents inside the document library. Webpart is deployed in site collection. If he selected the new menu, url is redirected to my webpart.

I have tried this by two way. I mentioned in as case 1 & case 2. But in the both cases i failed to fulfill my requirement

Below are the sample entries in Feature and Element manifest file

<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="59bba8e7-0cfc-46e3-9285-4597f8085e76" Title="My Custom Menus" Scope="Site" xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
<ElementManifests>
<ElementManifest Location="Elements.xml" />
</ElementManifests></Feature>

Case 1:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;

<CustomAction Id="EditMenu1" RegistrationType="FileType" RegistrationId="txt" Location="EditControlBlock" Sequence="106" ImageUrl="/_layouts/images/PPT16.GIF" Title="My Edit Menu" Rights="AddListItems,EditListItems">
<UrlAction Url="javascript:var surl='{SiteUrl}'; window.location='/test/mypage.aspx?siteurl='+surl+'&amp;itemurl={ItemUrl}&amp;itemid={ItemId}&amp;listid={ListId}&amp;Source='+window.location" />
</CustomAction>

<CustomAction Id="NewMenu1" GroupId="NewMenu" RegistrationType="List" RegistrationId="101" Location="Microsoft.SharePoint.StandardMenu" Sequence="1002" ImageUrl ="/_layouts/images/DOC32.GIF" Title="My New Menu" Rights="AddListItems,EditListItems">


 <UrlAction Url="javascript:var surl='{SiteUrl}'; window.location='/test/mypage.aspx?siteurl='+surl+'&amp;listid={ListId}&amp;Source='+window.location" />


 </CustomAction>
</Elements>

I am passing the current location to sourceurl in order to get the folder url

If i use the above code, it is redirected to rootsite but i have to redirect to site collection. Since by webpart is deployed in site collection. Is there is any way to get the site collection variable in the above case.

To overcome this issue i used the following code:

Case 2:

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
<CustomAction Id="EditMenu1" RegistrationType="FileType" RegistrationId="txt" Location="EditControlBlock" Sequence="106" ImageUrl="/_layouts/images/PPT16.GIF" Title="My Edit Menu" Rights="AddListItems,EditListItems">
<UrlAction Url="~sitecollection/test/mypage.aspx?siteurl={SiteUrl}&amp;itemurl={ItemUrl}&amp;itemid={ItemId}&amp;listid={ListId}&amp;Source=/" />


 </CustomAction>
<CustomAction Id="NewMenu1" GroupId="NewMenu" RegistrationType="List" RegistrationId="101" Location="Microsoft.SharePoint.StandardMenu" Sequence="1002" ImageUrl ="/_layouts/images/DOC32.GIF" Title="My New Menu" Rights="AddListItems,EditListItems">
<UrlAction Url="~sitecollection/test/mypage.aspx?siteurl={SiteUrl}&amp;listid={ListId}&amp;Source=/" />


 </CustomAction>

</Elements>

In this case, it is correctly redirected to the site collection. But fails to get the current location. By the help of current location only i am getting the folder location.

Could you please suggest me either how to get the site collection url in the case 1 or how to get folder location in case 2.