Implementing unattended Process Approval management
Do you want to be able to approve documents without landing on the website? Do you want to be able to solve your own approval tasks without going to the company?
I can give you a good idea.
We can make good use of the mobile messaging business to implement events through the WS callback,
Only need a text message will be able to achieve your approval or rejection
Everybody can extrapolate I'm just telling everybody to do it
:
The following is the reality of an unattended approval
The code is implemented as follows:
It's mine.
Here is the code
Using System;
Using System.Collections;
Using System.Collections.Generic;
Using System.Text;
Using Microsoft.SharePoint;
Using Microsoft.SharePoint.Workflow;
Using System.Data;
Namespace Spworkflowtaskdemo
{
Class Program
{
static void Main (string[] args)
{
Try
{
SPSite site = null;
Spsecurity.runwithelevatedprivileges (Delegate ()
{
site = new SPSite (@ "http://lh-vmpc:6060/");
SPWeb Web = site. OpenWeb ();
Web. Allowunsafeupdates = true;
Site. Allowunsafeupdates = true;
SPList lists = web. lists["Application List"];
SPWorkflowManager Manager = Site. Workflowmanager;
spworkflowtaskcollection tasks = lists. Items[lists. ITEMS.COUNT-1]. Workflows[0]. Tasks;
int index = tasks. Count-1;
foreach (SPField field in Tasks[index]. Fields)
//{
Console.WriteLine ("Name:{0}---value:{1}", field. InternalName, Tasks[index][field. InternalName]);
//}
tasks[index]["Status" = "approval";
tasks[index]["completed"] = "True";
tasks[index]["PercentComplete"] = 1;
tasks[index]["workflowoutcome"] = "Approved";
Tasks[index]. Properties[spbuiltinfieldid.comment] = "Approved";
Tasks[index]. properties["ows_taskstatus"] = "@";
Hashtable ht = new Hashtable ();
Ht. ADD ("Status", "completed");
Ht. ADD ("Completed", true);
Ht. ADD ("Ows_taskstatus", "#");
Ht. ADD ("Workflowoutcome", "OK");
Spworkflowtask.altertask (Tasks[index], HT, true);
Tasks[index]. Update ();
web. Close ();
web. Dispose ();
site. Close ();
Site. Dispose ();
});
}
catch (Exception e)
{
Console.WriteLine (E.tostring ());
}
The code has no real value, just hope that you can learn something in it,
Implementing unattended Process Approval management