Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. IT & Infrastructure
  4. Workflow Impersonation

Workflow Impersonation

Scheduled Pinned Locked Moved IT & Infrastructure
sharepointdatabasehelpquestioncareer
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    papy boom
    wrote on last edited by
    #1

    hi, i want to perform a task in a specific workflow in my sharepoint Site using a job. the problem by using code below,that impersonation doesn't work when i go to list of tasks and check who perform the task i find that user is always System\Account. could you tell me what's wrong with that code ? the line who made impersonation are in bold var q = new SPSiteDataQuery(); q.Lists = ""; q.Query = "0x0108011"; q.Webs = ""; q.ViewFields = ""; q.ViewFields += ""; q.ViewFields += ""; q.ViewFields += ""; q.RowLimit = 10; SPSite site = new SPSite("http://abt-mossdev/"); SPWeb web = site.OpenWeb(); SPUser user = web.AllUsers(YesMan); SPUserToken token = user.UserToken; SPSite impersonatedSiteCollection = new SPSite(SiteUrl, token); DataTable dt = impersonatedSiteCollection.RootWeb.GetSiteData(q); foreach (DataRow row in dt.Rows) { string listId = row("ListId"); SPList taskList = web.Lists(new Guid(listId)); string taskId = row("ID"); var task = taskList.GetItemById(Convert.ToInt32(taskId)); //Performing the task Hashtable taskHash = new Hashtable(); taskHash("PercentComplete") = "1"; taskHash("IsApproved") = "1"; taskHash(SPBuiltInFieldId.Modified_x0020_By) = "yesman"; SPWorkflowTask.AlterTask(task, taskHash, true); Thank you all

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups