Implementing unattended Process Approval management

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.