Last active
February 27, 2019 16:45
-
-
Save merkle-sitecore-gists/f9d320600de59b562ca26666863300a0 to your computer and use it in GitHub Desktop.
Bugfix for Sitecore 9 SocialConnect module creating items with an invalid name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
protected void SavePostMessage(string network, string NewtworkPagename, string postid, string pageid, ....) | |
{ | |
try | |
{ | |
using (SecurityDisabler securityDisabler = new SecurityDisabler()) | |
{ | |
Database database = Factory.GetDatabase("master"); | |
Item item = database.GetItem("/sitecore/system/Social/PostMessage"); | |
TemplateItem template = database.GetTemplate(SocialTemplates.SocialMessages.ID); | |
DateTime utcNow = DateTime.UtcNow; | |
string itemname = string.Concat(network, utcNow.ToString().Replace("/", "").Replace("\\", "").Replace(" ", "-").Replace(":", ""), "-", pagename); | |
itemname = itemname.Replace("\\", "").Replace("/", "").Replace(":", "").Replace("<", "").Replace(">", "").Replace("[", "").Replace("]", ""); | |
itemname = Sitecore.Data.Items.ItemUtil.ProposeValidItemName(itemname); // new line of code, create a valid item name for the Sitecore-item. | |
... | |
protected void SavePostMessageWithShedule(string network, string NewtworkPagename, string postid, string pageid, ....) | |
{ | |
... | |
itemname = Sitecore.Data.Items.ItemUtil.ProposeValidItemName(itemname); // new line of code, create a valid item name for the Sitecore-item. | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment