实现无人值守流程审批管理

实现无人值守流程审批管理

你想实现,不登陆网站就能审批文件?你想实现不用去公司就可以 解决自己的审批任务?
我可以给你一个 很好的思路。
我们可以很好的利用手机短信的业务来实现事件通过Ws回调,
只需要一个短信 就能实现你的审批 或者拒绝

大家可以举一反三 我只是告诉大家可以这样做

如图:
下面这个列子就是现实一个 无人值守的审批 
代码实现如下:



上面是我的截图
下面是代码 

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["申请列表"];
                    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"] = "批准";
                    tasks[index]["Completed"] = "True";
                    tasks[index]["PercentComplete"] = 1;
                    tasks[index]["WorkflowOutcome"] = "批准";
                    tasks[index].Properties[SPBuiltInFieldId.Comment] = "批准";
                    tasks[index].Properties["ows_TaskStatus"] = "@";
                    Hashtable ht = new Hashtable();
                    ht.Add("Status", "已完成");
                    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());
            }

  代码没有什么实际的价值,只是希望大家可以在其中学习一些东西,

原文地址:https://www.cnblogs.com/ningang/p/4321670.html