Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如果以编程方式设置自定义操作,如何设置操作url?_C#_Sharepoint_Sharepoint 2013 - Fatal编程技术网

C# 如果以编程方式设置自定义操作,如何设置操作url?

C# 如果以编程方式设置自定义操作,如何设置操作url?,c#,sharepoint,sharepoint-2013,C#,Sharepoint,Sharepoint 2013,当我使用xml中的常规自定义操作时,它具有: <UrlAction Url="~remoteAppUrl/Pages/Default.aspx?{StandardTokens}&amp;SPListItemId={ItemId}&amp;SPListId={ListId}&amp;SPItemUrl={ItemUrl}" /> 此url不工作。我不知道如何格式化这一个,我尝试了一切,但仍然有任何想法。有人能帮我吗 这是Sharepoint 2013的自动托管

当我使用xml中的常规自定义操作时,它具有:

<UrlAction Url="~remoteAppUrl/Pages/Default.aspx?{StandardTokens}&amp;SPListItemId={ItemId}&amp;SPListId={ListId}&amp;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}&amp;SPListItemId={ItemId}&amp;SPListId={ListId}&amp;SPItemUrl={ItemUrl}";
_customAction.Update();
clientContext.ExecuteQuery();