Implement unattended process approval management

Source: Internet
Author: User

What do you want to do? Do you want to solve your approval tasks without going to the company?
I can give you a good idea.
We can use the mobile phone text message service to implement Event Callback through ws,
You only need one text message to approve or reject your request.

I just want to tell you how to do this.

:
The following column is an unattended review.
The code is implemented as follows:

Above is my
Below 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-vnmpc: 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"] = "approved ";
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 practical value, but I hope you can learn something in it,

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.