when I am using normal custom actions from xml it has:
<UrlAction Url="~remoteAppUrl/Pages/Default.aspx?{StandardTokens}&SPListItemId={ItemId}&SPListId={ListId}&SPItemUrl={ItemUrl}" />
and its working fine, but when I am using
Microsoft.SharePoint.Client.UserCustomAction _customAction = web.UserCustomActions.Add();
_customAction.RegistrationType = UserCustomActionRegistrationType.ContentType;
_customAction.RegistrationId = _guidOfCreatedCT;
_customAction.Location = "EditControlBlock";
_customAction.Sequence = 450;
_customAction.Title = "TEST";
string rrr =AppRelativeVirtualPath.ToString();
_customAction.Url = "~remoteAppUrl/Pages/Default.aspx?{StandardTokens}&SPListItemId={ItemId}&SPListId={ListId}&SPItemUrl={ItemUrl}";
_customAction.Update();
clientContext.ExecuteQuery();
this url is not working. I dont know how to format this one, I tried everything and still any ideas. Someone can help me ?
This is autohosted app for Sharepoint 2013.
You only need &
to replace & in any XML structure, but you don't need to use &
in the code behind...
Simply try using http:// or https:// in front of your custom url. Otherwise SharePoint will think that the action url is within SharePoint and so it will automatically generate a site relative url.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.