New answers tagged

0

all that was mentioned by Mike are valid tips and should be deferentially checked and considered other thing I would check which may have a huge performance impact is the way You query items from SharePoint. Using SPQuery and GetItems() method is not the best way. First of all it does not provide any caching and returns SPListItem objects that have all ...


1

Several things to try: Instead of foreach loops, switch them out for 'for' loops, they have been proven to be faster: https://www.c-sharpcorner.com/article/for-vs-foreach-in-c-sharp/ I'd look into concatenation of string more efficiently: https://stackoverflow.com/questions/21078/most-efficient-way-to-concatenate-strings I'd replace all instances of ...


2

You need update folder metadata for the root folders after run the MoveTo method, modify the code as below. if (currentItem.ContentType.Name.ToLower().Contains("project")) { Console.WriteLine(currentItem["ID"]); SPFolder folder = omsWeb.GetFolder(omsWeb.ServerRelativeUrl + "/Shared Documents/"+currentItem["ID"].ToString()); var modified = folder....


0

We can add ViewFields in SPQuery to solve this issue. The following code for your reference. using (SPSite site = new SPSite("http://sp2013/sites/team")) { using (SPWeb web = site.OpenWeb()) { SPList spList = web.Lists.TryGetList("Workflow Tasks"); SPQuery qry = new SPQuery(); qry.Query = @"<Where><Eq><FieldRef ...


1

I suggest to use SPListItemCollection class instead of DataTable. Please try: using (SPSite site = new SPSite("YOUR SITE URL")) using (SPWeb web = site.OpenWeb()) { SPList list = web.Lists.TryGetList("Workflow Tasks"); var query = new SPQuery { Query = String.Format("<Where><Eq><FieldRef Name='{0}' /><Value Type='...


Top 50 recent answers are included