本文整理汇总了C#中System.Item.Paste方法的典型用法代码示例。如果您正苦于以下问题:C# Item.Paste方法的具体用法?C# Item.Paste怎么用?C# Item.Paste使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Item
的用法示例。
在下文中一共展示了Item.Paste方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestFixtureSetUp
public void TestFixtureSetUp()
{
// Create test content
m_home = Sitecore.Context.Database.GetItem("/sitecore/content/home");
using (new SecurityDisabler())
{
try
{
m_home.Paste(File.ReadAllText(HttpContext.Current.Server.MapPath(@"~\test data\blog manager content.xml")), true, PasteMode.Overwrite);
}
catch
{
// this "catch" is used to debug issues with the Paste() method call above
int y = 0;
y++;
}
Initialize();
// Create test user
try
{
var user = Sitecore.Security.Accounts.User.Create("sitecore\\" + TESTUSERNAME, TESTUSERNAME);
Roles.AddUserToRole("sitecore\\" + TESTUSERNAME, "sitecore\\sitecore client authoring");
var accessRule = AccessRule.Create(user, AccessRight.ItemWrite, PropagationType.Any, AccessPermission.Allow);
var accessRules = new AccessRuleCollection();
accessRules.Add(accessRule);
m_blog1.Security.SetAccessRules(accessRules);
}
catch
{
Membership.DeleteUser("sitecore\\" + TESTUSERNAME);
}
}
}
示例2: SetUp
public void SetUp()
{
// Create test content
m_home = Sitecore.Context.Database.GetItem("/sitecore/content/home");
using (new SecurityDisabler())
{
m_home.Paste(File.ReadAllText(HttpContext.Current.Server.MapPath(@"~\test data\comment manager content.xml")), false, PasteMode.Overwrite);
}
Initialize();
}
示例3: TestFixtureSetUp
public void TestFixtureSetUp()
{
// Create test content
m_home = Sitecore.Context.Database.GetItem("/sitecore/content/home");
using (new SecurityDisabler())
{
// Don't change IDs as blog item references category by ID
m_home.Paste(File.ReadAllText(HttpContext.Current.Server.MapPath(@"~\test data\category manager content.xml")), false, PasteMode.Overwrite);
}
Initialize();
}