C# 如果以编程方式设置自定义操作,如何设置操作url?
当我使用xml中的常规自定义操作时,它具有:C# 如果以编程方式设置自定义操作,如何设置操作url?,c#,sharepoint,sharepoint-2013,C#,Sharepoint,Sharepoint 2013,当我使用xml中的常规自定义操作时,它具有: <UrlAction Url="~remoteAppUrl/Pages/Default.aspx?{StandardTokens}&SPListItemId={ItemId}&SPListId={ListId}&SPItemUrl={ItemUrl}" /> 此url不工作。我不知道如何格式化这一个,我尝试了一切,但仍然有任何想法。有人能帮我吗 这是Sharepoint 2013的自动托管
<UrlAction Url="~remoteAppUrl/Pages/Default.aspx?{StandardTokens}&SPListItemId={ItemId}&SPListId={ListId}&SPItemUrl={ItemUrl}" />
此url不工作。我不知道如何格式化这一个,我尝试了一切,但仍然有任何想法。有人能帮我吗
这是Sharepoint 2013的自动托管应用程序。您只需
&
替换任何XML结构中的&,但不需要使用&代码>在代码隐藏…中,只需尝试在自定义url前面使用http://或https://即可。否则SharePoint会认为动作url在SharePoint中,因此会自动生成一个站点相对url。问题是,每当我添加某个url(例如,此按钮位于站点google.pl上)时,如果我将自定义动作url设置为google.pl,则会生成url“google.pl/google.pl当您通过XML添加它时,您有这个问题吗?没有,只有在post中有代码隐藏时才有。此代码使此自定义操作一切正常。。。url。。。
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();