如何发布站点地图SiteMap

SDK里是这样描述发布步骤的:

要编辑 ISV.Config,请执行下列步骤:

  1. 使用“导出自定义项”导出 ISV.Config
    1. 在导航窗格中,依次单击“设置”、“自定义”和“导出自定义项”
    2. 选择 ISV.Config,然后在“操作”工具栏上单击“导出所选自定义项”
  2. 创建导出的 XML 文件的备份副本。您可以使用此文件从错误中恢复。
  3. 对导出的 XML 文件进行更改。
  4. 使用“导入自定义项”工具导入更新的 XML 文件。
    1. 在导航窗格中,依次单击“设置”、“自定义”和“导入自定义项”
    2. 找到修改后的 XML 文件,然后单击“上载”。
    3. 在“操作”工具栏上,单击“导入所有自定义项”

其中第3步中只提到对XML文件进行更改,并没有明确更改方法,如果按照那样的步骤手动进行更改,在实际的项目部署中,明显是不可行的,找了许多资料,终于在一篇博客里提及代码实现的方法。

 

转自:http://krishchandrababu.spaces.live.com/blog/cns!F8384073BDA66530!423.entry

Use CRM webservice to change the Sitemap.xml or ISV.config, programatically.
There is a supported way to manipulate SiteMap XML, ISV.config, Entity manipulation, etc. and I have some time, I will update the little code snippet. Additional information can be found in the new SDK 3.0.4 (ISV Programming Guide).

To run this code you have to reference all the helper classes found in the new SDK 3.0.4 in the sdk samples/isvreadiness sub folder.

CrmService service=new CrmService();
service.Url="
http://localhost/mscrmservices/2006/crmservice.asmx";
service.Credentials=System.Net.CredentialCache.DefaultCredentials;
ExportXmlRequest export=new ExportXmlRequest();
export.ParameterXml="<export><entities></entities><nodes><node>sitemap</node></nodes></export>";

ExportXmlResponse entities = (ExportXmlResponse)service.Execute(export);
XmlDocument siteMapXml=new XmlDocument();
siteMapXml.PreserveWhitespace=true;
siteMapXml.LoadXml(entities.ExportXml);
Microsoft.Crm.Sdk.IsvReadiness.SiteMapCustomizer siteMapEditor=
 new Microsoft.Crm.Sdk.IsvReadiness.SiteMapCustomizer(siteMapXml);

Microsoft.Crm.Sdk.IsvReadiness.SupportingItems.SiteMap.SubArea subArea=
 new Microsoft.Crm.Sdk.IsvReadiness.SupportingItems.SiteMap.SubArea();
subArea.Id="nav_sometest";
subArea.Title="Click me for happiness";
subArea.Icon="some.gif";
subArea.Url="/someurl.aspx";

siteMapEditor.AddSubArea("Settings", "Settings", subArea);

ImportXmlRequest import=new ImportXmlRequest();
import.ParameterXml="<import><entities></entities><nodes><node>sitemap</node></nodes></import>";
import.CustomizationXml=siteMapXml.OuterXml;
service.Execute(import);

Note: Please make sure you also add the correct using statements for the web service.

-That's all for now.

参考:http://community.dynamics.com/blogs/crmjimwangchinese/default.aspx?PageIndex=2

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值