SharePoint online 2013 event receiver error
I am currently working on a SharePoint online project. My code generates 6 documents in 6 different document libraries along with other metadata. When I save data to a List, the event receiver fires and creates all the 6 documents. But sometimes it stops creating
the 6 documents and left with 1 or 2 documents. Sometimes documents has been created but without any metadata.
The same code is working fine in my on-premises environment, but it sometimes breaks in the Office 365 environment. I also created a log list to track the issue as we cannot debug in Office 365. In the log list I found a error message saying "Thread was
being aborted." Below is my code. please help it is happening only in Office 365 environment.
namespace ExcelGen.ExcelGenReceiver
using System;
using Microsoft.SharePoint;
/// <summary>
/// List Item Events
/// </summary>
public class ExcelGenReceiver : SPItemEventReceiver
/// <summary>
/// The template URL
/// </summary>
private const string TemplateUrl = "/Quotation Analysis Electrical/Forms/Quotation Analysis Sheet ELEC_Blank.xlsm";
/// <summary>
/// The template url1
/// </summary>
private const string TemplateUrl1 = "/Quotation Analysis Mechanical/Forms/Quotation Analysis Sheet MECH_Blank.xlsm";
/// <summary>
/// The template url2
/// </summary>
private const string TemplateUrl2 = "/TenderSummaryLib/Forms/TenderSummaryBlankMaster1.xlsm";
/// <summary>
/// The RFI template URL
/// </summary>
private const string RfiTemplateUrl = "/EstimatingRFI/Forms/RFI Schedule MASTER.docx";
/// <summary>
/// The drawing template URL
/// </summary>
private const string DrawingTemplateUrl = "/Tender and Drawing Schedule/Forms/Tender Document Drawing Schedule.docx";
/// <summary>
/// The tender return template URL
/// </summary>
private const string TenderReturnTemplateUrl = "/Est_Tender_Pricing_Document/Forms/Tender Pricing Document blank.xlsm";
/// <summary>
/// The project number
/// </summary>
private string projectNumber = string.Empty;
/// <summary>
/// The project name
/// </summary>
private string projectName = string.Empty;
/// <summary>
/// The no bid
/// </summary>
private string noBid;
/// <summary>
/// The team
/// </summary>
private string team;
/// <summary>
/// The description
/// </summary>
private string description;
/// <summary>
/// The status
/// </summary>
private string status;
/// <summary>
/// The electrical
/// </summary>
private SPUser electrical;
/// <summary>
/// The mechanical
/// </summary>
private SPUser mechanical;
/// <summary>
/// The document date
/// </summary>
private DateTime? docDate;
/// <summary>
/// The tender received
/// </summary>
private DateTime? tenderReceived;
/// <summary>
/// The tender return
/// </summary>
private DateTime? tenderReturn;
/// <summary>
/// The pre construction program start date
/// </summary>
private DateTime? preConstructionProgramStart;
/// <summary>
/// The pre construction program end date
/// </summary>
private DateTime? preConstructionProgramEnd;
/// <summary>
/// The sector
/// </summary>
private string sector;
/// <summary>
/// The design build
/// </summary>
private string designBuild;
/// <summary>
/// The build type
/// </summary>
private string buildType;
/// <summary>
/// The service program start date
/// </summary>
private DateTime? serviceProgramStart;
/// <summary>
/// The service program completion date
/// </summary>
private DateTime? serviceProgramCompletion;
/// <summary>
/// The client1
/// </summary>
private string client1;
/// <summary>
/// The client2
/// </summary>
private string client2;
/// <summary>
/// The client3
/// </summary>
private string client3;
/// <summary>
/// The client4
/// </summary>
private string client4;
/// <summary>
/// The consultant
/// </summary>
private string consultant;
/// <summary>
/// An item is being added.
/// </summary>
/// <param name="properties">The Item Event properties</param>
public override void ItemAdded(SPItemEventProperties properties)
//this.EventFiringEnabled = false;
var web = properties.Web;
var listItem = properties.ListItem;
try
LogIssue(web, null, "Item Added", "List Item Id {0}", listItem.ID);
if (!this.AttemptCopyProcess(listItem))
LogIssue(web, null, "List Id : " + listItem.ID, "AttemptCopyProcess failed.");
catch (Exception ex)
LogIssue(web, ex, "List Id : " + listItem.ID, "AttemptCopyProcess failed.");
finally
//this.EventFiringEnabled = true;
LogIssue(web, null, "List Id : " + listItem.ID, "Event Receiver completed sucessfully.");
/// <summary>
/// Logs any issues found
/// </summary>
/// <param name="webContext">The web context.</param>
/// <param name="exception">The exception, if null not exception details are written</param>
/// <param name="contextId">The context identifier, a unique identifier that allows us to know where the call originated, i.e. a List and ListItem Id, or a Page Url</param>
/// <param name="comment">The comment.</param>
/// <param name="args">The arguments.</param>
private static void LogIssue(SPWeb webContext, Exception exception, string contextId, string comment, params object[] args)
//// if (webContext.AllProperties.ContainsKey("EnableLogging"))
var list = webContext.Lists.TryGetList("ErrorIssues");
if (list != null)
var item = list.AddItem();
item["Title"] = contextId;
if (exception != null)
item["Message"] = exception.Message;
item["InnerException"] = exception.InnerException ?? (object)string.Empty;
item["StackTrace"] = exception.StackTrace;
if (!string.IsNullOrEmpty(comment))
item["Comment"] = string.Format(comment, args);
item.Update();
/// <summary>
/// Assigns the field.
/// </summary>
/// <param name="listItem">The list item.</param>
/// <param name="fieldName">Name of the field.</param>
/// <param name="contextId">The context identifier.</param>
/// <returns>The fields string value if present, otherwise string.empty.</returns>
private static string AssignField(SPListItem listItem, string fieldName, string contextId)
var fieldValue = string.Empty;
if (listItem.Fields.ContainsField(fieldName) && listItem[fieldName] != null)
fieldValue = listItem[fieldName].ToString();
else
LogIssue(listItem.Web, null, contextId, string.Format("Field not available : {0}", fieldName));
return fieldValue;
/// <summary>
/// Assigns the field as a DateTime
/// </summary>
/// <param name="listItem">The list item.</param>
/// <param name="fieldName">Name of the field.</param>
/// <param name="contextId">The context identifier.</param>
/// <returns>Returns the date if found, otherwise returns DateTime.MinValue</returns>
private static DateTime? AssignDateField(SPListItem listItem, string fieldName, string contextId)
DateTime? fieldValue = null;
if (listItem.Fields.ContainsField(fieldName) && listItem[fieldName] != null)
fieldValue = Convert.ToDateTime(listItem[fieldName].ToString());
else
LogIssue(listItem.Web, null, contextId, string.Format("Field not available : {0}", fieldName));
return fieldValue;
/// <summary>
/// Creates the folder.
/// </summary>
/// <param name="listdoc">The list.</param>
/// <param name="folderName">Name of the folder.</param>
private static void CreateFolder(SPList listdoc, string folderName)
LogIssue(listdoc.ParentWeb, null, "List Id : " + listdoc.ID, "Creating folder {0} in {1}", folderName, listdoc.RootFolder.ServerRelativeUrl);
// Updated by Indusnet
SPListItem folder1 = listdoc.Items.Add(listdoc.RootFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder);
folder1["Name"] = folderName;
folder1.Update();
listdoc.Update();
// End Updated
/// <summary>
/// Assigns the user field.
/// </summary>
/// <param name="listItem">The list item.</param>
/// <param name="fieldName">Name of the field.</param>
/// <param name="contextId">The context identifier.</param>
/// <returns>Returns the user if found, otherwise null.</returns>
private static SPUser AssignUserField(SPListItem listItem, string fieldName, string contextId)
SPUser user = null;
if (listItem.Fields.ContainsField(fieldName) && listItem[fieldName] != null)
var userField = (SPFieldUser)listItem.Fields.GetField(fieldName);
var fieldValue = (SPFieldUserValue)userField.GetFieldValue(listItem["electrical_proj_manager"].ToString());
user = fieldValue.User;
else
LogIssue(listItem.Web, null, contextId, string.Format("Field not available : {0}", fieldName));
return user;
/// <summary>
/// Attempts the copy process.
/// </summary>
/// <param name="listItem">The list item.</param>
/// <returns>True if it successfully processed, false otherwise.</returns>
private bool AttemptCopyProcess(SPListItem listItem)
if (listItem.ParentList.Title != "Enquiry_Template")
LogIssue(listItem.Web, null, "List Id : " + listItem.ID, "ListItem titles is not Enquiry_Template, aborting.");
return false;
var finalNum = "15-" + new Random().Next(0, 9999).ToString("D4");
this.Initialize(listItem, finalNum);
if (this.noBid != "Yes")
LogIssue(listItem.Web, null, "List Id : " + listItem.ID, "The noBid field does not equal Yes, aborting.");
return false;
this.CopyFiles(listItem.Web, finalNum);
this.CreateFolders(listItem.Web);
return true;
/// <summary>
/// Copies the files.
/// </summary>
/// <param name="web">The web.</param>
/// <param name="finalNum">The final number.</param>
private void CopyFiles(SPWeb web, string finalNum)
LogIssue(web, null, "Web Id : " + web.ID, "Setting the copying of files ...");
var mechanicalQuoteList = web.Lists["Quotation Analysis Mechanical"];
var electricalQuoteList = web.Lists["Quotation Analysis Electrical"];
var tenderSummarList = web.Lists["TenderSummaryLib"];
var estimatingList = web.Lists["EstimatingRFI"];
var tenderSheduleList = web.Lists["Tender and Drawing Schedule"];
var tenderPricingList = web.Lists["Est_Tender_Pricing_Document"];
var url1 = mechanicalQuoteList.RootFolder.ServerRelativeUrl;
var url = electricalQuoteList.RootFolder.ServerRelativeUrl;
var url2 = tenderSummarList.RootFolder.ServerRelativeUrl;
var urlA = estimatingList.RootFolder.ServerRelativeUrl;
var urlB = tenderSheduleList.RootFolder.ServerRelativeUrl;
var urlC = tenderPricingList.RootFolder.ServerRelativeUrl;
var foldername1 = string.Empty;
var foldername = string.Empty;
var foldername2 = string.Empty;
var foldernameA = string.Empty;
var foldernameB = string.Empty;
var foldernameC = string.Empty;
var folder1 = web.Folders[url1 + "/" + foldername1];
var folder = web.Folders[url + "/" + foldername];
var folder2 = web.Folders[url2 + "/" + foldername2];
var folderA = web.Folders[urlA + "/" + foldernameA];
var folderB = web.Folders[urlB + "/" + foldernameB];
var folderC = web.Folders[urlC + "/" + foldernameC];
if (!folder1.Exists && !folder.Exists && !folder2.Exists && !folderA.Exists && !folderB.Exists && !folderC.Exists)
var folders1 = web.GetFolder(url1).SubFolders;
var folders = web.GetFolder(url).SubFolders;
var folders2 = web.GetFolder(url2).SubFolders;
var foldersA = web.GetFolder(urlA).SubFolders;
var foldersB = web.GetFolder(urlB).SubFolders;
var foldersC = web.GetFolder(urlC).SubFolders;
folders1.Add(foldername1);
folders.Add(foldername);
folders2.Add(foldername2);
foldersA.Add(foldernameA);
foldersB.Add(foldernameB);
foldersC.Add(foldernameC);
var file1 = web.GetFile(web.Site.Url + TemplateUrl1);
var file = web.GetFile(web.Site.Url + TemplateUrl);
var file2 = web.GetFile(web.Site.Url + TemplateUrl2);
var fileA = web.GetFile(web.Site.Url + RfiTemplateUrl);
var fileB = web.GetFile(web.Site.Url + DrawingTemplateUrl);
var fileC = web.GetFile(web.Site.Url + TenderReturnTemplateUrl);
if (file1 != null && file != null && file2 != null && fileA != null && fileB != null && fileC != null)
var fileName = string.Format("{0}/{1}{2}", folder1.ServerRelativeUrl, this.projectName, ".xlsm");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 1 {0} to {1}...", file1.Name, fileName);
var byteArray1 = file1.OpenBinary();
var uploadedFile1 = folder1.Files.Add(fileName, byteArray1, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 1 Uploaded with new ID of {0}", uploadedFile1.Item.ID);
this.EventFiringEnabled = false;
var listitem1 = uploadedFile1.Item;
listitem1["Name"] = this.projectName;
listitem1["EnquiryNo"] = finalNum;
listitem1["Project_Name"] = this.projectName;
listitem1["Tender_Received"] = this.tenderReceived;
listitem1["Tender_Return"] = this.tenderReturn;
listitem1["Quotation_Analysis_Mech_Url"] = "https://my site url/Quotation%20Analysis%20Mechanical/Forms/DispForm.aspx?ID=" + listitem1.ID;
listitem1.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 1.");
fileName = string.Format("{0}/{1}{2}", folder.ServerRelativeUrl, this.projectName, ".xlsm");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 2 {0} to {1}...", file.Name, fileName);
var byteArray = file.OpenBinary();
var uploadedFile = folder.Files.Add(fileName, byteArray, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 2 Uploaded with new ID of {0}", uploadedFile.Item.ID);
this.EventFiringEnabled = false;
var listitem = uploadedFile.Item;
listitem["Name"] = this.projectName;
listitem["EnquiryNo"] = finalNum;
listitem["Project_Name"] = this.projectName;
listitem["Tender_Received"] = this.tenderReceived;
listitem["Tender_Return"] = this.tenderReturn;
listitem["Quotation_Analysis_Elec_Url"] = "https://my site url/Quotation%20Analysis%20Electrical/Forms/DispForm.aspx?ID=" + listitem.ID;
listitem.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 2.");
fileName = string.Format("{0}/{1}{2}", folderA.ServerRelativeUrl, this.projectName, ".docx");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 3 {0} to {1}...", fileA.Name, fileName);
var byteArrayA = fileA.OpenBinary();
var uploadedFileA = folderA.Files.Add(fileName, byteArrayA, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 3 Uploaded with new ID of {0}", uploadedFileA.Item.ID);
this.EventFiringEnabled = false;
var listitemA = uploadedFileA.Item;
listitemA["Name"] = this.projectName;
listitemA["EnquiryNo"] = finalNum;
listitemA["Project_Name"] = this.projectName;
listitemA["Date"] = this.docDate;
listitemA["Description"] = this.description;
listitemA["ProjectNo"] = this.projectNumber;
listitemA["RFIUrl"] = "https://my site url/EstimatingRFI/Forms/DispForm.aspx?ID=" + listitemA.ID;
listitemA.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 3.");
fileName = string.Format("{0}/{1}{2}", folderB.ServerRelativeUrl, this.projectName, ".docx");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 4 {0} to {1}...", fileB.Name, fileName);
var byteArrayB = fileB.OpenBinary();
var uploadedFileB = folderB.Files.Add(fileName, byteArrayB, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 4 Uploaded with new ID of {0}", uploadedFileB.Item.ID);
this.EventFiringEnabled = false;
var listitemB = uploadedFileB.Item;
listitemB["Name"] = this.projectName;
listitemB["EnquiryNo"] = finalNum;
listitemB["Project_Name"] = this.projectName;
listitemB["Date"] = this.docDate;
listitemB["Description"] = this.description;
listitemB["ProjectNo"] = this.projectNumber;
listitemB["DrawingURL"] = "https://my site url/Tender%20and%20Drawing%20Schedule/Forms/DispForm.aspx?ID=" + listitemB.ID;
listitemB.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 4.");
fileName = string.Format("{0}/{1}{2}", folderC.ServerRelativeUrl, this.projectName, ".xlsm");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 5 {0} to {1}...", fileC.Name, fileName);
var byteArrayC = fileC.OpenBinary();
var uploadedFileC = folderC.Files.Add(fileName, byteArrayC, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 5 Uploaded with new ID of {0}", uploadedFileC.Item.ID);
this.EventFiringEnabled = false;
var listitemC = uploadedFileC.Item;
listitemC["Name"] = this.projectName;
listitemC["EnquiryNo"] = finalNum;
listitemC["Project_Name"] = this.projectName;
listitemC["Date"] = this.docDate;
listitemC["Description"] = this.description;
listitemC["ProjectNo"] = this.projectNumber;
listitemC["PricingURL"] = "https://my site url/Est_Tender_Pricing_Document/Forms/DispForm.aspx?ID=" + listitemC.ID;
listitemC.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 5.");
fileName = string.Format("{0}/{1}{2}", folder2.ServerRelativeUrl, this.projectName, ".xlsm");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 5 {0} to {1}...", file2.Name, fileName);
var byteArray2 = file2.OpenBinary();
var uploadedFile2 = folder2.Files.Add(fileName, byteArray2, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 6 Uploaded with new ID of {0}", uploadedFile2.Item.ID);
this.EventFiringEnabled = false;
var listitem2 = uploadedFile2.Item;
listitem2["Name"] = this.projectName;
listitem2["EnquiryNo"] = finalNum;
listitem2["Project_Name"] = this.projectName;
listitem2["Date"] = this.docDate;
listitem2["Team"] = this.team;
listitem2["Estimator_Electrical"] = this.electrical;
listitem2["Estimator_Mechanical"] = this.mechanical;
listitem2["Status"] = this.status;
listitem2["Tender_Received"] = this.tenderReceived;
listitem2["Tender_Return"] = this.tenderReturn;
listitem2["Sector"] = this.sector;
listitem2["Design_Build"] = this.designBuild;
listitem2["Build_Type"] = this.buildType;
listitem2["Service_Prog_Start"] = this.serviceProgramStart;
listitem2["Service_Prog_Completion"] = this.serviceProgramCompletion;
listitem2["Client_1"] = this.client1;
listitem2["Client_2"] = this.client2;
listitem2["Client_3"] = this.client3;
listitem2["Client_4"] = this.client4;
listitem2["Consultant"] = this.consultant;
listitem2["Pre-construction_Prog_Start"] = this.preConstructionProgramStart;
listitem2["Pre-construction_Prog_End"] = this.preConstructionProgramEnd;
listitem2["Tender_Summary_Url"] = "https://my site url/TenderSummaryLib/Forms/DispForm.aspx?ID=" + listitem2.ID;
listitem2.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 6.");
/// <summary>
/// Creates the folders.
/// </summary>
/// <param name="web">The web.</param>
private void CreateFolders(SPWeb web)
var projectListId = web.Lists.Add(this.projectName.Replace(' ', '_'), string.Empty, SPListTemplateType.DocumentLibrary);
var projectList = web.Lists[projectListId];
projectList.OnQuickLaunch = true; // The document library will appear in Quick Launch bar.
CreateFolder(projectList, "1.Tender Documents");
CreateFolder(projectList, "2. Electrical");
CreateFolder(projectList, "3. Mechanical");
CreateFolder(projectList, "4. Correspondance");
CreateFolder(projectList, "5. Settlement Meeting Docs");
CreateFolder(projectList, "6. Tender Return Docs");
CreateFolder(projectList, "7. Tender Handover");
projectList.Update();
/// <summary>
/// Initializes the specified list item.
/// </summary>
/// <param name="listItem">The list item.</param>
/// <param name="finalNum">The final number.</param>
private void Initialize(SPListItem listItem, string finalNum)
var contextId = string.Format("List:{0}, Id:{1}", listItem.ParentList.Title, listItem.ID);
this.noBid = AssignField(listItem, "Bid", contextId);
this.projectName = AssignField(listItem, "Project_Name", contextId);
var teamlookup = AssignField(listItem, "Team", contextId);
var lookupParts = teamlookup.Split(new[] { ";#" }, StringSplitOptions.None);
this.team = lookupParts[1];
this.description = AssignField(listItem, "Description", contextId);
this.status = AssignField(listItem, "enquiry_status", contextId);
this.electrical = AssignUserField(listItem, "electrical_proj_manager", contextId);
this.mechanical = AssignUserField(listItem, "mechanical_proj_manager", contextId);
this.docDate = AssignDateField(listItem, "Date", contextId);
this.tenderReceived = AssignDateField(listItem, "Tender_Received", contextId);
this.tenderReturn = AssignDateField(listItem, "Tender_Return", contextId);
this.preConstructionProgramStart = AssignDateField(listItem, "Pre-construction_Prog_Start", contextId);
this.preConstructionProgramEnd = AssignDateField(listItem, "Pre-construction_Prog_End", contextId);
this.sector = AssignField(listItem, "Sector", contextId);
this.designBuild = AssignField(listItem, "Design_Build", contextId);
this.buildType = AssignField(listItem, "Build_Type", contextId);
this.serviceProgramStart = AssignDateField(listItem, "Service_Prog_Start", contextId);
this.serviceProgramCompletion = AssignDateField(listItem, "Service_Prog_Completion", contextId);
this.client1 = AssignField(listItem, "Client_1", contextId);
this.client2 = AssignField(listItem, "Client_2", contextId);
this.client3 = AssignField(listItem, "Client_3", contextId);
this.client4 = AssignField(listItem, "Client_4", contextId);
this.consultant = AssignField(listItem, "Consultant", contextId);
if (this.status == "Won")
this.projectNumber = string.Format("15-{0}-{1}", this.team, new Random().Next(0, 9999).ToString("D4"));
if (this.status == "Active" || this.status == "Closed")
this.projectNumber = "No Project No";
listItem["ProjectNo"] = this.projectNumber;
listItem["EnquiryNo"] = finalNum;
listItem.Web.AllowUnsafeUpdates = true;
listItem.SystemUpdate(false);
Hi,
In this forum we mainly discuss questions and feedbacks about Office client products, as your question is about SharePoint 2013, I suggest you post this thread in SharePoint forum:
https://social.technet.microsoft.com/Forums/office/en-US/home?category=sharepoint
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
Regards,
Melon Chen
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected]
Similar Messages
-
SharePoint 2013 event receiver error
I am currently working on a SharePoint online project. I am facing a strange issue. My code generates 6 documents
in 6 different document libraries along with other metadata. When I save data to a List, the event receiver fires and creates all the 6 documents. But sometimes it stops creating the 6 documents and left with 1 or 2 documents. Sometimes documents has been
created but without any metadata. The same code is working fine in my on-premises environment, but it sometimes breaks in the Office 365 environment. I also created a log list to track the issue as we cannot debug in Office 365. In the log list I found a error
message saying "Thread was being aborted." Below is my code. please help it is happening only in Office 365 environment.
using Microsoft.SharePoint;
/// <summary>
/// List Item Events
/// </summary>
public class ExcelGenReceiver : SPItemEventReceiver
/// <summary>
/// The template URL
/// </summary>
private const string TemplateUrl = "/Quotation Analysis Electrical/Forms/Quotation Analysis Sheet ELEC_Blank.xlsm";
/// <summary>
/// The template url1
/// </summary>
private const string TemplateUrl1 = "/Quotation Analysis Mechanical/Forms/Quotation Analysis Sheet MECH_Blank.xlsm";
/// <summary>
/// The template url2
/// </summary>
private const string TemplateUrl2 = "/TenderSummaryLib/Forms/TenderSummaryBlankMaster1.xlsm";
/// <summary>
/// The RFI template URL
/// </summary>
private const string RfiTemplateUrl = "/EstimatingRFI/Forms/RFI Schedule MASTER.docx";
/// <summary>
/// The drawing template URL
/// </summary>
private const string DrawingTemplateUrl = "/Tender and Drawing Schedule/Forms/Tender Document Drawing Schedule.docx";
/// <summary>
/// The tender return template URL
/// </summary>
private const string TenderReturnTemplateUrl = "/Est_Tender_Pricing_Document/Forms/Tender Pricing Document blank.xlsm";
/// <summary>
/// The project number
/// </summary>
private string projectNumber = string.Empty;
/// <summary>
/// The project name
/// </summary>
private string projectName = string.Empty;
/// <summary>
/// The no bid
/// </summary>
private string noBid;
/// <summary>
/// The team
/// </summary>
private string team;
/// <summary>
/// The description
/// </summary>
private string description;
/// <summary>
/// The status
/// </summary>
private string status;
/// <summary>
/// The electrical
/// </summary>
private SPUser electrical;
/// <summary>
/// The mechanical
/// </summary>
private SPUser mechanical;
/// <summary>
/// The document date
/// </summary>
private DateTime? docDate;
/// <summary>
/// The tender received
/// </summary>
private DateTime? tenderReceived;
/// <summary>
/// The tender return
/// </summary>
private DateTime? tenderReturn;
/// <summary>
/// The pre construction program start date
/// </summary>
private DateTime? preConstructionProgramStart;
/// <summary>
/// The pre construction program end date
/// </summary>
private DateTime? preConstructionProgramEnd;
/// <summary>
/// The sector
/// </summary>
private string sector;
/// <summary>
/// The design build
/// </summary>
private string designBuild;
/// <summary>
/// The build type
/// </summary>
private string buildType;
/// <summary>
/// The service program start date
/// </summary>
private DateTime? serviceProgramStart;
/// <summary>
/// The service program completion date
/// </summary>
private DateTime? serviceProgramCompletion;
/// <summary>
/// The client1
/// </summary>
private string client1;
/// <summary>
/// The client2
/// </summary>
private string client2;
/// <summary>
/// The client3
/// </summary>
private string client3;
/// <summary>
/// The client4
/// </summary>
private string client4;
/// <summary>
/// The consultant
/// </summary>
private string consultant;
/// <summary>
/// An item is being added.
/// </summary>
/// <param name="properties">The Item Event properties</param>
public override void ItemAdded(SPItemEventProperties properties)
//this.EventFiringEnabled = false;
var web = properties.Web;
var listItem = properties.ListItem;
try
LogIssue(web, null, "Item Added", "List Item Id {0}", listItem.ID);
if (!this.AttemptCopyProcess(listItem))
LogIssue(web, null, "List Id : " + listItem.ID, "AttemptCopyProcess failed.");
catch (Exception ex)
LogIssue(web, ex, "List Id : " + listItem.ID, "AttemptCopyProcess failed.");
finally
//this.EventFiringEnabled = true;
LogIssue(web, null, "List Id : " + listItem.ID, "Event Receiver completed sucessfully.");
/// <summary>
/// Logs any issues found
/// </summary>
/// <param name="webContext">The web context.</param>
/// <param name="exception">The exception, if null not exception details are written</param>
/// <param name="contextId">The context identifier, a unique identifier that allows us to know where the call originated, i.e. a List and ListItem Id, or a Page Url</param>
/// <param name="comment">The comment.</param>
/// <param name="args">The arguments.</param>
private static void LogIssue(SPWeb webContext, Exception exception, string contextId, string comment, params object[] args)
//// if (webContext.AllProperties.ContainsKey("EnableLogging"))
var list = webContext.Lists.TryGetList("ErrorIssues");
if (list != null)
var item = list.AddItem();
item["Title"] = contextId;
if (exception != null)
item["Message"] = exception.Message;
item["InnerException"] = exception.InnerException ?? (object)string.Empty;
item["StackTrace"] = exception.StackTrace;
if (!string.IsNullOrEmpty(comment))
item["Comment"] = string.Format(comment, args);
item.Update();
/// <summary>
/// Assigns the field.
/// </summary>
/// <param name="listItem">The list item.</param>
/// <param name="fieldName">Name of the field.</param>
/// <param name="contextId">The context identifier.</param>
/// <returns>The fields string value if present, otherwise string.empty.</returns>
private static string AssignField(SPListItem listItem, string fieldName, string contextId)
var fieldValue = string.Empty;
if (listItem.Fields.ContainsField(fieldName) && listItem[fieldName] != null)
fieldValue = listItem[fieldName].ToString();
else
LogIssue(listItem.Web, null, contextId, string.Format("Field not available : {0}", fieldName));
return fieldValue;
/// <summary>
/// Assigns the field as a DateTime
/// </summary>
/// <param name="listItem">The list item.</param>
/// <param name="fieldName">Name of the field.</param>
/// <param name="contextId">The context identifier.</param>
/// <returns>Returns the date if found, otherwise returns DateTime.MinValue</returns>
private static DateTime? AssignDateField(SPListItem listItem, string fieldName, string contextId)
DateTime? fieldValue = null;
if (listItem.Fields.ContainsField(fieldName) && listItem[fieldName] != null)
fieldValue = Convert.ToDateTime(listItem[fieldName].ToString());
else
LogIssue(listItem.Web, null, contextId, string.Format("Field not available : {0}", fieldName));
return fieldValue;
/// <summary>
/// Creates the folder.
/// </summary>
/// <param name="listdoc">The list.</param>
/// <param name="folderName">Name of the folder.</param>
private static void CreateFolder(SPList listdoc, string folderName)
LogIssue(listdoc.ParentWeb, null, "List Id : " + listdoc.ID, "Creating folder {0} in {1}", folderName, listdoc.RootFolder.ServerRelativeUrl);
// Updated by Indusnet
SPListItem folder1 = listdoc.Items.Add(listdoc.RootFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder);
folder1["Name"] = folderName;
folder1.Update();
listdoc.Update();
// End Updated
/// <summary>
/// Assigns the user field.
/// </summary>
/// <param name="listItem">The list item.</param>
/// <param name="fieldName">Name of the field.</param>
/// <param name="contextId">The context identifier.</param>
/// <returns>Returns the user if found, otherwise null.</returns>
private static SPUser AssignUserField(SPListItem listItem, string fieldName, string contextId)
SPUser user = null;
if (listItem.Fields.ContainsField(fieldName) && listItem[fieldName] != null)
var userField = (SPFieldUser)listItem.Fields.GetField(fieldName);
var fieldValue = (SPFieldUserValue)userField.GetFieldValue(listItem["electrical_proj_manager"].ToString());
user = fieldValue.User;
else
LogIssue(listItem.Web, null, contextId, string.Format("Field not available : {0}", fieldName));
return user;
/// <summary>
/// Attempts the copy process.
/// </summary>
/// <param name="listItem">The list item.</param>
/// <returns>True if it successfully processed, false otherwise.</returns>
private bool AttemptCopyProcess(SPListItem listItem)
if (listItem.ParentList.Title != "Enquiry_Template")
LogIssue(listItem.Web, null, "List Id : " + listItem.ID, "ListItem titles is not Enquiry_Template, aborting.");
return false;
var finalNum = "15-" + new Random().Next(0, 9999).ToString("D4");
this.Initialize(listItem, finalNum);
if (this.noBid != "Yes")
LogIssue(listItem.Web, null, "List Id : " + listItem.ID, "The noBid field does not equal Yes, aborting.");
return false;
this.CopyFiles(listItem.Web, finalNum);
this.CreateFolders(listItem.Web);
return true;
/// <summary>
/// Copies the files.
/// </summary>
/// <param name="web">The web.</param>
/// <param name="finalNum">The final number.</param>
private void CopyFiles(SPWeb web, string finalNum)
LogIssue(web, null, "Web Id : " + web.ID, "Setting the copying of files ...");
var mechanicalQuoteList = web.Lists["Quotation Analysis Mechanical"];
var electricalQuoteList = web.Lists["Quotation Analysis Electrical"];
var tenderSummarList = web.Lists["TenderSummaryLib"];
var estimatingList = web.Lists["EstimatingRFI"];
var tenderSheduleList = web.Lists["Tender and Drawing Schedule"];
var tenderPricingList = web.Lists["Est_Tender_Pricing_Document"];
var url1 = mechanicalQuoteList.RootFolder.ServerRelativeUrl;
var url = electricalQuoteList.RootFolder.ServerRelativeUrl;
var url2 = tenderSummarList.RootFolder.ServerRelativeUrl;
var urlA = estimatingList.RootFolder.ServerRelativeUrl;
var urlB = tenderSheduleList.RootFolder.ServerRelativeUrl;
var urlC = tenderPricingList.RootFolder.ServerRelativeUrl;
var foldername1 = string.Empty;
var foldername = string.Empty;
var foldername2 = string.Empty;
var foldernameA = string.Empty;
var foldernameB = string.Empty;
var foldernameC = string.Empty;
var folder1 = web.Folders[url1 + "/" + foldername1];
var folder = web.Folders[url + "/" + foldername];
var folder2 = web.Folders[url2 + "/" + foldername2];
var folderA = web.Folders[urlA + "/" + foldernameA];
var folderB = web.Folders[urlB + "/" + foldernameB];
var folderC = web.Folders[urlC + "/" + foldernameC];
if (!folder1.Exists && !folder.Exists && !folder2.Exists && !folderA.Exists && !folderB.Exists && !folderC.Exists)
var folders1 = web.GetFolder(url1).SubFolders;
var folders = web.GetFolder(url).SubFolders;
var folders2 = web.GetFolder(url2).SubFolders;
var foldersA = web.GetFolder(urlA).SubFolders;
var foldersB = web.GetFolder(urlB).SubFolders;
var foldersC = web.GetFolder(urlC).SubFolders;
folders1.Add(foldername1);
folders.Add(foldername);
folders2.Add(foldername2);
foldersA.Add(foldernameA);
foldersB.Add(foldernameB);
foldersC.Add(foldernameC);
var file1 = web.GetFile(web.Site.Url + TemplateUrl1);
var file = web.GetFile(web.Site.Url + TemplateUrl);
var file2 = web.GetFile(web.Site.Url + TemplateUrl2);
var fileA = web.GetFile(web.Site.Url + RfiTemplateUrl);
var fileB = web.GetFile(web.Site.Url + DrawingTemplateUrl);
var fileC = web.GetFile(web.Site.Url + TenderReturnTemplateUrl);
if (file1 != null && file != null && file2 != null && fileA != null && fileB != null && fileC != null)
var fileName = string.Format("{0}/{1}{2}", folder1.ServerRelativeUrl, this.projectName, ".xlsm");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 1 {0} to {1}...", file1.Name, fileName);
var byteArray1 = file1.OpenBinary();
var uploadedFile1 = folder1.Files.Add(fileName, byteArray1, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 1 Uploaded with new ID of {0}", uploadedFile1.Item.ID);
this.EventFiringEnabled = false;
var listitem1 = uploadedFile1.Item;
listitem1["Name"] = this.projectName;
listitem1["EnquiryNo"] = finalNum;
listitem1["Project_Name"] = this.projectName;
listitem1["Tender_Received"] = this.tenderReceived;
listitem1["Tender_Return"] = this.tenderReturn;
listitem1["Quotation_Analysis_Mech_Url"] = "https://groupportal.sharepoint.com/sites/EnginSouth/Quotation%20Analysis%20Mechanical/Forms/DispForm.aspx?ID=" + listitem1.ID;
listitem1.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 1.");
fileName = string.Format("{0}/{1}{2}", folder.ServerRelativeUrl, this.projectName, ".xlsm");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 2 {0} to {1}...", file.Name, fileName);
var byteArray = file.OpenBinary();
var uploadedFile = folder.Files.Add(fileName, byteArray, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 2 Uploaded with new ID of {0}", uploadedFile.Item.ID);
this.EventFiringEnabled = false;
var listitem = uploadedFile.Item;
listitem["Name"] = this.projectName;
listitem["EnquiryNo"] = finalNum;
listitem["Project_Name"] = this.projectName;
listitem["Tender_Received"] = this.tenderReceived;
listitem["Tender_Return"] = this.tenderReturn;
listitem["Quotation_Analysis_Elec_Url"] = "https://groupportal.sharepoint.com/sites/EnginSouth/Quotation%20Analysis%20Electrical/Forms/DispForm.aspx?ID=" + listitem.ID;
listitem.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 2.");
fileName = string.Format("{0}/{1}{2}", folderA.ServerRelativeUrl, this.projectName, ".docx");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 3 {0} to {1}...", fileA.Name, fileName);
var byteArrayA = fileA.OpenBinary();
var uploadedFileA = folderA.Files.Add(fileName, byteArrayA, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 3 Uploaded with new ID of {0}", uploadedFileA.Item.ID);
this.EventFiringEnabled = false;
var listitemA = uploadedFileA.Item;
listitemA["Name"] = this.projectName;
listitemA["EnquiryNo"] = finalNum;
listitemA["Project_Name"] = this.projectName;
listitemA["Date"] = this.docDate;
listitemA["Description"] = this.description;
listitemA["ProjectNo"] = this.projectNumber;
listitemA["RFIUrl"] = "https://groupportal.sharepoint.com/sites/EnginSouth/EstimatingRFI/Forms/DispForm.aspx?ID=" + listitemA.ID;
listitemA.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 3.");
fileName = string.Format("{0}/{1}{2}", folderB.ServerRelativeUrl, this.projectName, ".docx");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 4 {0} to {1}...", fileB.Name, fileName);
var byteArrayB = fileB.OpenBinary();
var uploadedFileB = folderB.Files.Add(fileName, byteArrayB, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 4 Uploaded with new ID of {0}", uploadedFileB.Item.ID);
this.EventFiringEnabled = false;
var listitemB = uploadedFileB.Item;
listitemB["Name"] = this.projectName;
listitemB["EnquiryNo"] = finalNum;
listitemB["Project_Name"] = this.projectName;
listitemB["Date"] = this.docDate;
listitemB["Description"] = this.description;
listitemB["ProjectNo"] = this.projectNumber;
listitemB["DrawingURL"] = "https://groupportal.sharepoint.com/sites/EnginSouth/Tender%20and%20Drawing%20Schedule/Forms/DispForm.aspx?ID=" + listitemB.ID;
listitemB.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 4.");
fileName = string.Format("{0}/{1}{2}", folderC.ServerRelativeUrl, this.projectName, ".xlsm");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 5 {0} to {1}...", fileC.Name, fileName);
var byteArrayC = fileC.OpenBinary();
var uploadedFileC = folderC.Files.Add(fileName, byteArrayC, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 5 Uploaded with new ID of {0}", uploadedFileC.Item.ID);
this.EventFiringEnabled = false;
var listitemC = uploadedFileC.Item;
listitemC["Name"] = this.projectName;
listitemC["EnquiryNo"] = finalNum;
listitemC["Project_Name"] = this.projectName;
listitemC["Date"] = this.docDate;
listitemC["Description"] = this.description;
listitemC["ProjectNo"] = this.projectNumber;
listitemC["PricingURL"] = "https://groupportal.sharepoint.com/sites/EnginSouth/Est_Tender_Pricing_Document/Forms/DispForm.aspx?ID=" + listitemC.ID;
listitemC.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 5.");
fileName = string.Format("{0}/{1}{2}", folder2.ServerRelativeUrl, this.projectName, ".xlsm");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 5 {0} to {1}...", file2.Name, fileName);
var byteArray2 = file2.OpenBinary();
var uploadedFile2 = folder2.Files.Add(fileName, byteArray2, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 6 Uploaded with new ID of {0}", uploadedFile2.Item.ID);
this.EventFiringEnabled = false;
var listitem2 = uploadedFile2.Item;
listitem2["Name"] = this.projectName;
listitem2["EnquiryNo"] = finalNum;
listitem2["Project_Name"] = this.projectName;
listitem2["Date"] = this.docDate;
listitem2["Team"] = this.team;
listitem2["Estimator_Electrical"] = this.electrical;
listitem2["Estimator_Mechanical"] = this.mechanical;
listitem2["Status"] = this.status;
listitem2["Tender_Received"] = this.tenderReceived;
listitem2["Tender_Return"] = this.tenderReturn;
listitem2["Sector"] = this.sector;
listitem2["Design_Build"] = this.designBuild;
listitem2["Build_Type"] = this.buildType;
listitem2["Service_Prog_Start"] = this.serviceProgramStart;
listitem2["Service_Prog_Completion"] = this.serviceProgramCompletion;
listitem2["Client_1"] = this.client1;
listitem2["Client_2"] = this.client2;
listitem2["Client_3"] = this.client3;
listitem2["Client_4"] = this.client4;
listitem2["Consultant"] = this.consultant;
listitem2["Pre-construction_Prog_Start"] = this.preConstructionProgramStart;
listitem2["Pre-construction_Prog_End"] = this.preConstructionProgramEnd;
listitem2["Tender_Summary_Url"] = "https://groupportal.sharepoint.com/sites/EnginSouth/TenderSummaryLib/Forms/DispForm.aspx?ID=" + listitem2.ID;
listitem2.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 6.");
/// <summary>
/// Creates the folders.
/// </summary>
/// <param name="web">The web.</param>
private void CreateFolders(SPWeb web)
var projectListId = web.Lists.Add(this.projectName.Replace(' ', '_'), string.Empty, SPListTemplateType.DocumentLibrary);
var projectList = web.Lists[projectListId];
projectList.OnQuickLaunch = true; // The document library will appear in Quick Launch bar.
CreateFolder(projectList, "1.Tender Documents");
CreateFolder(projectList, "2. Electrical");
CreateFolder(projectList, "3. Mechanical");
CreateFolder(projectList, "4. Correspondance");
CreateFolder(projectList, "5. Settlement Meeting Docs");
CreateFolder(projectList, "6. Tender Return Docs");
CreateFolder(projectList, "7. Tender Handover");
projectList.Update();
/// <summary>
/// Initializes the specified list item.
/// </summary>
/// <param name="listItem">The list item.</param>
/// <param name="finalNum">The final number.</param>
private void Initialize(SPListItem listItem, string finalNum)
var contextId = string.Format("List:{0}, Id:{1}", listItem.ParentList.Title, listItem.ID);
this.noBid = AssignField(listItem, "Bid", contextId);
this.projectName = AssignField(listItem, "Project_Name", contextId);
var teamlookup = AssignField(listItem, "Team", contextId);
var lookupParts = teamlookup.Split(new[] { ";#" }, StringSplitOptions.None);
this.team = lookupParts[1];
this.description = AssignField(listItem, "Description", contextId);
this.status = AssignField(listItem, "enquiry_status", contextId);
this.electrical = AssignUserField(listItem, "electrical_proj_manager", contextId);
this.mechanical = AssignUserField(listItem, "mechanical_proj_manager", contextId);
this.docDate = AssignDateField(listItem, "Date", contextId);
this.tenderReceived = AssignDateField(listItem, "Tender_Received", contextId);
this.tenderReturn = AssignDateField(listItem, "Tender_Return", contextId);
this.preConstructionProgramStart = AssignDateField(listItem, "Pre-construction_Prog_Start", contextId);
this.preConstructionProgramEnd = AssignDateField(listItem, "Pre-construction_Prog_End", contextId);
this.sector = AssignField(listItem, "Sector", contextId);
this.designBuild = AssignField(listItem, "Design_Build", contextId);
this.buildType = AssignField(listItem, "Build_Type", contextId);
this.serviceProgramStart = AssignDateField(listItem, "Service_Prog_Start", contextId);
this.serviceProgramCompletion = AssignDateField(listItem, "Service_Prog_Completion", contextId);
this.client1 = AssignField(listItem, "Client_1", contextId);
this.client2 = AssignField(listItem, "Client_2", contextId);
this.client3 = AssignField(listItem, "Client_3", contextId);
this.client4 = AssignField(listItem, "Client_4", contextId);
this.consultant = AssignField(listItem, "Consultant", contextId);
if (this.status == "Won")
this.projectNumber = string.Format("15-{0}-{1}", this.team, new Random().Next(0, 9999).ToString("D4"));
if (this.status == "Active" || this.status == "Closed")
this.projectNumber = "No Project No";
listItem["ProjectNo"] = this.projectNumber;
listItem["EnquiryNo"] = finalNum;
listItem.Web.AllowUnsafeUpdates = true;
listItem.SystemUpdate(false);Hi,
In this forum we mainly discuss questions and feedbacks about Office client products, as your question is about SharePoint 2013, I suggest you post this thread in SharePoint forum:
https://social.technet.microsoft.com/Forums/office/en-US/home?category=sharepoint
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
Regards,
Melon Chen
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
SharePoint Online 2013 Workflows for one List stopped working after 07/08/2014
Our client host application in Office 365 SharePoint Online 2013, and we just found that all workflows for one list stopped working after 7, Aug 2014. It kept displaying pop-up message "Something went wrong. To try again, reload the page and then start
the workflow." when manually start a workflow for this List.
Tested workflow for other list, there's no problem.
Could anyone can help on this issue?Our client host application in Office 365 SharePoint Online 2013, and we just found that all workflows for one list stopped working after 7, Aug 2014. It kept displaying pop-up message "Something went wrong. To try again, reload the page and then start
the workflow." when manually start a workflow for this List.
Tested workflow for other list, there's no problem.
Could anyone can help on this issue? -
I want to know What are the different tools and techniques available to track analytics in SharePoint online 2013. Please provide your suggestions/ inputs. Thanks in advance.
you can Use the Web Analytics Integration app to
connect your SharePoint Online public website to third-party web analytics services, such as Webtrends, Google Analytics, Adobe, and so on.
Google Analytics
Webtrends for SharePoint
CARDIOLOG ANALYTICS
Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog -
Visio Web Access Refresh in SharePoint Online 2013
I'm trying to pull in SharePoint Online 2013 List data into a Visio Pro 2013 diagram and then serve the diagram into a SharePoint Online Page under a Visio Data Access Web Part.
I have no working knowledge of Visio, but made a data connection and presented SPO list data on my diagram. But the data appears to be static when deployed to the Visio Access Web Part - even when I manually refesh. I think, I'm not correctly
adding list fields to my document.
I've set refresh rates on both the document and the web part, but neither help.
For a demo I want to show a single list field - nothing fancy.
Possible to have dynamic data from an SPO List hosted in SPO?
Any way to filter which row is sent from through a URL Query string?
How?Hi ,
Per the following article, the data sources will be disconnected and can't be refreshed after the Visio is published to SharePoint.
"You can publish PivotDiagrams or Timeline diagrams to SharePoint, but they are disconnected from the data sources and can’t be refreshed."
http://office.microsoft.com/en-001/visio-help/save-diagrams-to-sharepoint-HA102749359.aspx
And also I would suggest you post in Office365 SharePoint online forum for a better assistance regarding this issue through the following link.
http://community.office365.com/en-us/f/154.aspx
Thanks,
Daniel Yang
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]
Daniel Yang
TechNet Community Support -
Hi All,
We are migrating from on-premise SharPoint 2010 to SharePoint online 2013.
I have few questions below:
What are the possibilities and limitations of using Out of the box content search webpart?
Also, how the cross site publishing will work in SharePoint online something with managed navigations and product catalog apporach? if it is not supported, then what are the alternatives to acheive the same?
Appriciate any commnets/clarifications.Thanks in advance.
Thanks,
Dhananjay.Here are the possibilities of Content search webparts
http://office.microsoft.com/en-in/office365-sharepoint-online-enterprise-help/configure-a-content-search-web-part-in-sharepoint-HA104119042.aspx
http://office.microsoft.com/en-in/office365-sharepoint-online-enterprise-help/when-to-use-the-content-query-web-part-or-the-content-search-web-part-in-sharepoint-HA104206662.aspx
Compare the strengths and limitations of the Web Parts
It’s important that you understand the strengths and limitations of the two Web Parts because if you choose the wrong one, your site could run into performance problems. You can use both Web Parts to show content that is based on a query. In a simplified
world, here’s how you can decide between the two:
Use the CQWP when you have a limited amount of content, your query is simple, and you don’t expect your content to grow much in the future.
Use the CSWP in all other scenarios when you want to show content that is based on a query.
The table below gives a comparison of the two Web Parts:
Web Part behavior
Content Query Web Part
Content Search Web Part
Query configuration
Easy
You’ll need to know about certain search features such as
managed properties.
Query across large amounts of content
Limited
Yes
Handle complex queries
Limited
Yes
Scale to handle future content growth
Limited
Yes
Display content from other site collections
No
Yes (see
section below)
Design of query results can be customized
Yes, by using XSLT.
Yes, by using HTML.
Maintenance cost in a complex site architecture
High
Small (see
section below)
Narrow down the query results that are displayed in the Web Part
No
Yes, in combination with the
Refinement Web Part.
It was not there previously but then it was added to Office 365
http://blogs.office.com/2013/10/29/search-innovations-for-site-and-portal-design-in-sharepoint-online/
If this helped you resolve your issue, please mark it Answered -
Sharepoint 2013, event receiver to rename files not working
I coded an event receiver (ItemAdding) that renames for example a .txt file to a .text file (it does not matter the extensions, it is just an example). In my code what I do is to an SPFile.MoveTo operation. It works fine in SP2010 but when I execute
the same code in SP 2013, when the operation is done using IE I get the text "Sorry, something went wrong" and then "File Not Found".
In the logs this is what I see:
12/23/2013 15:48:49.16 w3wp.exe (0x17B0) 0x0AC8 SharePoint Foundation
General ai1wu Medium System.IO.FileNotFoundException: The system cannot find the file specified.
(Exception from HRESULT: 0x80070002), StackTrace: at Microsoft.SharePoint.SPWeb.GetFileOrFolderProperties(String strUrl, ListDocsFlags listDocsFlags, Boolean throwException, SPBasePermissions& permMask) at Microsoft.SharePoint.SPFile.PropertiesCore(Boolean
throwException) at Microsoft.SharePoint.SPFile.get_Length() at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadPage.OnSubmit(Object o, EventArgs e) at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadExPage.OnSubmit(Object
o, EventArgs e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessReque... f72b639c-77b1-5045-c3a2-b23f24ae71c0
It's clear that the Sharepoint upload code tries to do things with the original name and it does not realize that it was renamed.
Can I do something from my event receiver code like using the AfterProperties to bypass this error?
ThanksHi Dennis,
The issue still persists. Here is the code:
public override void ItemAdded(SPItemEventProperties properties)
SPSecurity.RunWithElevatedPrivileges(delegate()
try
OutputDebugStringA("Inside ItemAdded");
string szHttpUrl = properties.WebUrl + "/" + properties.AfterUrl;
SPWeb openedWeb = properties.Web.Site.OpenWeb(properties.Web.ID);
SPFile spf = openedWeb.GetFile(szHttpUrl);
EventFiringEnabled = false;
string szUrl = properties.AfterUrl;
szUrl = szUrl + ".renamed";
string szNewFileName;
if (szUrl.LastIndexOf('\\') != -1) szNewFileName = szUrl.Substring(szUrl.LastIndexOf('\\') + 1);
else if (szUrl.LastIndexOf('/') != -1) szNewFileName = szUrl.Substring(szUrl.LastIndexOf('/') + 1);
else szNewFileName = szUrl;
if (properties.ListItem != null)
properties.ListItem["Title"] = szNewFileName;
properties.ListItem.Update();
spf.MoveTo(szUrl);
EventFiringEnabled = true;
base.ItemAdded(properties);
OutputDebugStringA("Renaming to " + szUrl);
catch (System.Exception exception)
OutputDebugStringA("ItemAdded ERROR: " + exception.ToString()); -
Microsoft Sharepoint Designer 2013 encountered an error during setup
I'm trying to install SharePoint Designer 2013 on my system, but I keep getting this error with no other detail. Looking into the SetupExe log file that the event viewer pointed to didn't really identify anything that would point me
to the culprit (or at least nothing I could decipher). I am running Windows 7 (64 bit) and Office 2010 (32 bit). Anyone run into this before?I am also trying to install SP Designer 2013 (32-bit) on my Windows 7 Pro 64-bit OS with MS Office 2010 32-bit and getting the same error about 30% into the install. I have attempted to uninstall other 3rd party programs and apps for example Citrix
and Skype and still no success. I tried booting up in safe mode and get the same error right at the onset of the install.
Update: Tried a "clean boot" install and that also failed. -
Create a User account in active directory from SharePoint online 2013 list data
Hello,
I am trying to create a SharePoint list through which i can create a user account into active directory,
1 - HR is sending the detail in the email body to a Specific email address ([email protected]) like below..
First Name: XYZ
Last Name: ABC
Address: ABC 123
Designation: Analyst
Employee ID: 10492
and so on
2 - I need to pickup every new email data of the above section into sharepoint list (in Column)
First Name Last Name Address Designation Employee ID
3 - I want to create a event receiver through which i can go ahead and find the new data in the list and then create a user in the active directory,
I tried very hard and since i dont have much experience in coding part, any help will be highly appreciated
Thank you
Aman1- Configure Incoming Email Setting at your SharePoint Farm -
https://technet.microsoft.com/en-us/library/cc262947.aspx
http://blogs.technet.com/b/harmeetw/archive/2012/12/29/sharepoint-2013-configure-incoming-emails-with-exchange-server-2013.aspx
2- Configure your Sharepoint List Incoming e-mail settings for [email protected] - ListSetting-Communications->Incoming e-mail settings. -
https://support.office.com/en-in/article/Enable-and-configure-e-mail-support-for-a-list-or-library-dcaf44a0-1d9b-451a-84c7-6c52e7db908e
3- Write an Incoming Email Receiver , and Add you Email Body Parsing Code (retrive value of fields , firstname , lastname etc) in
EmailReceived() method. also add the code for adding new user in Active Directory
http://blogs.msdn.com/b/tejasr/archive/2010/03/06/event-handler-code-to-add-incoming-emails-with-subject-discussion-id-as-replies.aspx
https://pholpar.wordpress.com/2010/01/13/creating-a-simple-email-receiver-for-a-document-library/
4- Active Directory Code Help -
http://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-Directory-via-C
http://www.codeproject.com/Tips/534718/Add-User-to-Active-Directory
Thanks
Ganesh Jat [My Blog |
LinkedIn | Twitter ]
Please click 'Mark As Answer' if a post solves your problem or 'Vote As Helpful' if it was useful. -
Hi,
I am getting below error in SharePoint PPS 2013 Dashboard Designer. While create the Analysis Service by using "PROVIDER="MSOLAP";DATA SOURCE="http://testpivot2013:9090/Source%20Documents/TestSSource.xlsx"
"An error occurred connecting to this data source. Please check the data source for any unsaved changes and click on Test Data Source button to confirm connection to the data source. "
I have checked all the Sites and done all the steps also. But still getting the error.Its frustrating like anything. Everything is configured correctly but still getting this error.
Thanks in advance.
Poomani SankaranHi Poomani,
Thanks for posting your issue,
you must have to Install SQL Server 2012 ADOMD.Net on your machine and find the browse the below mentioned URL to create SharePoint Dashboard with Analysis service step by step.
http://www.c-sharpcorner.com/UploadFile/a9d961/create-an-analysis-service-data-source-connection-using-shar/
I hope this is helpful to you, mark it as Helpful.
If this works, Please mark it as Answered.
Regards,
Dharmendra Singh (MCPD-EA | MCTS)
Blog : http://sharepoint-community.net/profile/DharmendraSingh -
Unable to get User Information in infopath form hosted on sharepoint online(2013)
Im trying to retrieve user information (department, Manager, Work E- Mail, Etc..) into an infopath form hosted in sharepoint online using "/_vti_bin/UserProfileService.asmx"
web service. But it returns me an error when im opening the form as :
An error occurred while
trying to connect
to a
web service. Error ID 5566
Any idea about how to get those information into a form which hosted in Office365 environment?
Thanks.I believe this is a known issue:http://support.microsoft.com/kb/2674193/en-us
-
Workflow in SharePoint Online 2013
Is is possible to have dynamic workflow in Sharepoint?
I want to create a workflow using visual studio or designer and the levels of approval in workflow will be controlled by a list. If the list contains 5 levels of approvers, workflow should be able to build 5 levels at runtime. If possible then, whether possible
in SharePoint online.
I am little new to Visual Studio workflow and office 365.
Please help.Hi Arun,
Thanks for posting your query, Kindly browse the below mentioned URL to achieve multiple level workflow, it uses Recall function to call workflow multiple times
http://blogs.msdn.com/b/sharepointdesigner/archive/2012/08/16/a-sample-approval-workflow-which-can-be-recalled-by-initiator.aspx
Also,
check out below mentioned URLs
http://sharepointwf.codeplex.com/
http://amalhashim.wordpress.com/2013/03/14/sharepoint-custom-approval-workflow-with-dynamic-approvers-using-sharepoint-designer/
I hope this is helpful to you, mark it as Helpful.
If this works, Please mark it as Answered.
Regards,
Dharmendra Singh (MCPD-EA | MCTS)
Blog : http://sharepoint-community.net/profile/DharmendraSingh -
This is for SharePoint Online. I have a number of workflows on a list that are in a 'suspended' state when I navigate to the workflows page for the item. When I click the link to view the workflow, I get a server error. I need to terminate these workflows.
Hi,
Based on your description, you want to terminate these workflows in SharePoint online.
You can terminate these workflows by the CSOM implementation through passing the ID of the list and list item.
You can refer to the code snippets below.
// connect to the workflow services via a CSOM client context
var clientContext = new ClientContext(siteCollectionUrl);
var workflowServicesManager = new WorkflowServicesManager(clientContext, clientContext.Web);
// connect to the instance service
var workflowInstanceService = workflowServicesManager.GetWorkflowInstanceService();
// get all instances
var workflowInstances = workflowInstanceService.EnumerateInstancesForListItem(listId, listItemId);
clientContext.Load(workflowInstances);
clientContext.ExecuteQuery();
foreach (var instance in workflowInstances)
// is this what we are looking for?
// if so, suspend it
workflowInstanceService.SuspendWorkflow(instance);
// or you can terminate it
workflowInstanceService.TerminateWorkflow(instance);
There is a similar case:
https://social.msdn.microsoft.com/Forums/office/en-US/c62e1d54-bd58-4d38-9514-d58cd22557e4/stop-and-restart-workflow-on-item-edit-sharepoint-online?forum=sharepointdevelopment
Best regards
Sara Fan
TechNet Community Support -
How to convert word documents to html page in sharepoint online 2013
Hi,
I am new SharePoint and still learning it.
I have been tasked to do the following on office 365 E3 SharePoint 2013 Online edition.
1) I have to create a Web page in asp.net
2) This page needs to show document from a given SharePoint folder and bind them in a grid or dropdown on the asp .net web page
3) On selecting the document from the drop down or gird (on asp .net webpage), I need to show the SharePoint word document as HTML on the webpage (something like word to html) Note: These SharePoint word document may contain Images, bullets, tables etc.
What I have been able to do till now
1) I have been able to connect to SharePoint from ASP .net application.
2) I have been able to retrieve document from a specific SharePoint folder.
3) Read the document from SharePoint folder and bind them to a drop down on the asp .net page.
What is missing?
I am not aware about any API that SharePoint Online provides to convert Word document to HTML. Any code sample or reference on how to will be much appreciated.
I am not also not sure what is the best way of achieving the functionality this?
Thanks
KrishnaIf this was SharePoint server then it would be easy however in O365 You need to create a app which will use the word automation service and below is powershell which you can use for the conversion:-
# This script will convert Docx to PDF using word automation and similarly it can be used to convert to HTML
$wordFile="http://contoso/kick.docx"
$pdfFile="http://contoso/kick.pdf"
$wasp = Get-SPServiceApplicationProxy | where { $_.TypeName -eq "Word Automation Services Proxy" }
$site = Get-SPSite "http://contoso"
$ConvertJob = New-Object Microsoft.Office.Word.Server.Conversions.SyncConverter($wasp)
$ConvertJob.UserToken = $site.UserToken
$ConvertJob.Settings.UpdateFields = $false
$ConvertJob.Settings.OutputFormat = "PDF"
$ConvertJob.Convert($wordFile, $pdfFile) -
Display xls-files in browser (Sharepoint online 2013)
I've seen this question answered with "xls is not supported" several times, but according to
this page viewing should now be supported:
Excel 97- Excel 2003 Workbook (.xls) or Excel 97- Excel 2003 Template (.xlt)
If a workbook is in .xls or .xlt format, you can typically view but not edit a workbook in a browser window. When the file is edited, it is saved in .xlsx or .xltx format.
I can't get it to work though, has anyone of you been able to open a xls-file in the Excel web app?Hi ,
According to your description, I tested in my SharePoint Online and get the same result.
If you hover over drop down, if you don't see view in browser then the file can't be opened in browser. So .xls file doesn't seem to be supported.
I recommend that you open the file in Excel 2010 or Microsoft Excel 2013, and then save the file as one of the supported formats. The following table shows the recommended file formats for the Excel 2013
Web App.
Product
File format
Microsoft Excel 2013 Web App
Excel Workbook (*.xlsx) Excel Macro-Enabled Workbook (.xlsm)
Best Regards,
Eric
Eric Tao
TechNet Community Support
Maybe you are looking for
-
Screen painter is not working properly.
Hi, when i execute se51 the screen painter is not coming properly. some dotted line coming and throughing the below message. EU_SCRP_WN32 : timeout during allocate / CPIC-CALL: 'ThSAPCMRCV' i am using sap gui 710 final release with patch 7. can plz s
-
Safari used to show the icon for my web site in its address bar, but doesn't any more. There has been no change to the favicon.ico file, but our site is on a new server with possibly slightly different configuration. Also, more than one version of Ma
-
Change standard MIR7 document header screen
Hi there dear ABAP'ers. Could you please tell me is it possible to modify the standard MIR7 screen in document header section to add there another input field? User would enter that field a special period number. Then that infrmation would be saved t
-
Connect coldfusion with sql server
HI everybody I need to know if i can use sql server as a database and coldfusion as the webpage interface builder???? Can these 2 program work together (be connected to each-other)?? if yes can anybody explain how it can be done or any link or some
-
MSS Team calender problem - Manager's Assistant
Hi I am putting together an MSS role for Personal Assistants of managers....ie instead of using chief positions as standard I'm creating new OADP entries and assigning them to iViews (eg attendanceoverview)....all good until I came to the Team Calend