protected void btnPostAtFacebook_Click(object sender, EventArgs e) { if (txtTemplateFacebook.Text.Trim() == "") { ShowError(ResHelper.GetString("socialnetworking.facebook.emptyerror")); return; } string template = txtTemplateFacebook.Text; // Process template MacroResolver mr = MacroResolver.GetInstance(); string textToSend = mr.ResolveMacros(template); // Send text string postUrl = FacebookProvider.Publish(textToSend, CMSContext.CurrentSiteName); // Check if post was succesfully published bool success = !string.IsNullOrEmpty(postUrl); if (success) { ShowConfirmation(ResHelper.GetString("socialnetworking.facebook.sendsuccess")); dataElement.IsPublished = true; dataElement.AutoPostAfterPublishing = false; dataElement.Template = txtTemplateFacebook.Text; dataElement.PostURL = postUrl; try { // Save dataElement into database node.SetValue(FieldInfo.Name, SerializeData().OuterXml); if (IsWorkflow) { DocumentHelper.UpdateDocument(node, node.TreeProvider); } else { node.Update(); } RenderControls(); } catch (Exception ex) { EventLogProvider ev = new EventLogProvider(); ev.LogEvent("FacebookAutoPost", "AfterPost", ex, CMSContext.CurrentSiteID); } } else { ShowError(ResHelper.GetString("socialnetworking.facebook.senderror")); } }