asp.net - 如何使用 API 在 Sitecore 5.3 中发布项目

标签 asp.net sitecore

使用 Sitecore 5.3,发布给定项目需要哪些 API 调用?如果配置了多个发布目标,您将如何指定发布到哪个目标?

最佳答案

我的代码实际上是针对 Sitecore 6 的,但我们在运行 5.3 时使用了几乎相同的代码

不用说,也许吧,但在我们从 Master 发布到 Web 的代码中,我们只在节点 /sitecore/content/home/projects/ongoing

下发布项目
DateTime publishDate = DateTime.Now;
var master = Sitecore.Configuration.Factory.GetDatabase("master");
var targetDB = Sitecore.Configuration.Factory.GetDatabase("web");
var pubOpts = new Sitecore.Publishing.PublishOptions(master, targetDB, Sitecore.Publishing.PublishMode.Full, Sitecore.Data.Managers.LanguageManager.GetLanguage("sv", master), publishDate);
pubOpts.Deep = true;
string idstr = master.Items["/sitecore/content/Home/Projects/Ongoing"].ID.ToString();
var id = new ID(idstr);
pubOpts.RootItem = master.Items[id];
var pub = new Sitecore.Publishing.Publisher(pubOpts);
Sitecore.Jobs.Job pubJob = pub.PublishAsync();
pubJob.Start();

关于asp.net - 如何使用 API 在 Sitecore 5.3 中发布项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1280906/

相关文章:

sitecore 无法将语言版本发布到网络数据库

c# - 如何更改管道中的 RenderingContext?

用于从作者定义的文件夹结构中选择链接的 Sitecore 字段

c# - 动态 Action 链接

c# - Asp.NET MVC 是 MVC 还是 MVP?

javascript - 如何使用asp.net c#访问多选下拉列表

sitecore - 如何在索引更新时更新 Sitecore Web Api 输出的缓存

c# - System.InvalidOperationException : 'Unable to resolve service for type ' Microsoft. AspNetCore.Hosting.IHostingEnvironment'

c# - 在提交表单之前执行方法

sitecore - 如何将 Sitecore 从 7.5 升级到 8.1 Update 3?