SharePoint 2010 Circulation list in "Group Work Site" template provides user with the ability to get confirmation or dis-confirmation from recipients without developing any kind of approval workflow. It provides recipients with Confirm and Disconfirm options in ribbon of display form.
There is one common mistake developer usually do while working with this list programatically.
Specially when you create a list item programatically, you use following code (Line numbers are included for reference):
1. SPList circulationList = SPContext.Current.Web.Lists["Circulation"];
2. SPListItem circulationItem = circulationList.AddItem();
3. circulationItem["Title"] = titleText;
4. circulationItem["Body"] = bodyText;
5. circulationItem["DueDate"] = DateTime.Today.AddDays(7);
6. circulationItem["Confidential"] = true;
7. circulationItem["AllowEditing"] = false;
8. SPFieldUserValueCollection recipients = new SPFieldUserValueCollection();
9. recipients.Add(new SPFieldUserValue(SPContext.Current.Web, user1.ID, user1.Name));
10. recipients.Add(new SPFieldUserValue(SPContext.Current.Web, user2.ID, user2.Name));
11. circulationItem["V4SendTo"] = recipients;
12. circulationItem.Update();
Problem: When recipient users view this list item, they cannot confirm this because both Confirm and Disconfirm option are disabled for them.
Solution: There are two hidden fields which are not even listed in the columns of List Settings page of this list.
Add following code before line 12.
circulationItem["V4NotConfirmed"] = recipients;
This will resolve the issue.
There is one common mistake developer usually do while working with this list programatically.
Specially when you create a list item programatically, you use following code (Line numbers are included for reference):
1. SPList circulationList = SPContext.Current.Web.Lists["Circulation"];
2. SPListItem circulationItem = circulationList.AddItem();
3. circulationItem["Title"] = titleText;
4. circulationItem["Body"] = bodyText;
5. circulationItem["DueDate"] = DateTime.Today.AddDays(7);
6. circulationItem["Confidential"] = true;
7. circulationItem["AllowEditing"] = false;
8. SPFieldUserValueCollection recipients = new SPFieldUserValueCollection();
9. recipients.Add(new SPFieldUserValue(SPContext.Current.Web, user1.ID, user1.Name));
10. recipients.Add(new SPFieldUserValue(SPContext.Current.Web, user2.ID, user2.Name));
11. circulationItem["V4SendTo"] = recipients;
12. circulationItem.Update();
Problem: When recipient users view this list item, they cannot confirm this because both Confirm and Disconfirm option are disabled for them.
Solution: There are two hidden fields which are not even listed in the columns of List Settings page of this list.
- V4Confirmed: contains users who have confirmed this item.
- V4NotConfirmed: contains users who have disconfirmed this item.
Add following code before line 12.
circulationItem["V4NotConfirmed"] = recipients;
This will resolve the issue.
No comments:
Post a Comment