Thursday, March 16, 2017

What are SharePoint Features ? Define the scope / levels of features?

SharePoint Features are part of packaging and deployment in SharePoint.
Features can be activated or deactivated in SharePoint. 
Features represent a set of functionality.
 

They have four possible scopes / levels
 
Farm- at the Farm level
Web application-  at the Web application level 
Site-  at Site Collection level 
Web-  at Single site level
 
A farm level feature is something that affects the whole farm, for example provisioning a custom timer job or deploying a Business Connectivity Services model.
 
A web application feature can be activated so that it only affects a single web application, and a typical example is a feature that modifies the web.config file.
 
A site scoped feature can be activated so that it only affects a site collection, an example being the deployment of a master page to the master pages catalogue.
 

Finally, a web scoped feature can be activated for a single site, for instance setting the default master page for that site.

DIFFERENCE BETWEEN ITEM.UPDATE() VS SYSTEM.UPDATE() VS UPDATE.OVERWRITEVERSION() IN SHAREPOINT LIST UPDATE VS SYTEMUPDATE(BOOLEAN)

DIFFERENCE BASE
ITEM.UPDATE()
SYSTEMUPDATE()
UPDATEOVERWRITEVERSION()
SYSTEMUPDATE (BOOLEAN)
Item Version
Item.Update() creates automatically new version of list item as Update
No new version.
Updates the item but does not create a new version
true to increment the item version; otherwise, false.
“Modified” and “Modified by”  Fields
Updates the “Modified” and “Modified by” values.
No changes in the “Modified” and “Modified By” fields.
Updates the “Modified” and “Modified by” values.
No changes in the “Modified” and “Modified By” fields.

Wednesday, March 15, 2017

Retrieve items from a particular folder of a list

using (SPWeb spWeb = SPContext.Current.Site.AllWebs["Reports"]) { SPList spList = spWeb.Lists.TryGetList("ManageReports"); SPQuery spQuery = new SPQuery(); //Setting the ViewAttribute to "Scope='Recursive'" //fetches all items from the list, //ie., also the items within the folders spQuery.ViewAttributes = "Scope=\"Recursive\""; SPListItemCollection items = spList.GetItems(spQuery); }

Get all the item of specific folder of Document Library or list in SharePoint using C#

string FolderName = "Peak";
                    using (SPWeb web = site.OpenWeb())
                    {
                        SPList oList = web.Lists["YourListName"];
                        SPListItemCollection collListItems = null;
                        foreach (SPFolder subFolder in oList.RootFolder.SubFolders)
                        {
                            if (subFolder.Name.ToLower() == FolderName.ToLower().Trim())
                            {
                                SPQuery oQuery = new SPQuery();
                                oQuery.Query = "<OrderBy><FieldRef Name=’Modified’ Ascending=’False’ /></OrderBy>";
                                oQuery.Folder = subFolder;
                                collListItems = oList.GetItems(oQuery);
                                break;
                            }
                        }
                    }

Failed on Start (Workflow was canceled by System Account.)

For your issue, I recommend to follow the steps as below:
  1. Clear SharePoint Designer cache: How to Clear Your SharePoint Designer 2010/2013 Cache
  2. Deactivate all "Workflow" features at the Site Collection level.
  3. Enable all "Workflow" features at the Site Collection level.
  4. PSCONFIG (Not Necessary) (or run the SharePoint 2010 products configuration wizard)
  5. Delete the bad workflow.
  6. Create a new workflow on the list with an valid user.