SharePoint workflow user - sharepoint

I have created a SharePoint workflow in visual studio , I have extended this workflow from the default SharePoint approval workflow as discribed here
The workflow is running properly. Is there a way I can get the workflow to run in the context of the user instead of th system account?

There are a couple of reasons this is not as desirable as it might seem. Firstly, the wrorkflow has to do things that the user does not have permissions to do directly. Secondly, workflows are background tasks, and as such there may not be a logged in user when the code is running.
If you just need a specific task to run as a user, take a look at http://blackninjasoftware.com/2009/04/09/how-to-programmatically-impersonate-users-in-sharepoint/

Related

Trying to Publish a Workflow From SharePoint Designer 2010 to SharePoint 2010

Let me start off by saying that I am not a SharePoint guru, nor an administrator for this site. I have enough rights to build my site. I have taken on the task of creating a site at work to make things better since it has gone through several people's hands and I take it as a challenge that I can do it.
So I have a workflow I created in SPD 2010 to send an email out based on an kickoff action in List A that references email addresses in List B since I am sending this email to people outside the organization. I have even tried to make a simple workflow to send an email to my name in the To: field and TEST in the Subject and Body. No Luck.
The issue lies in the fact that when I try to publish the workflow to the site, after checking for any errors (none I might add), I get back a "Workflow Error" that says "Errors were found when compiling the workflow. The workflow files were saved but cannot be run" and if I hit the Advanced button it says "Unexpected error on server associating the workflow."
I am looking to this forum to determine if this error is related in some way to an incorrect setting in the SharePoint Server that I don't know about, if it has anything to do with a lack of permissions from the overall SharePoint Server administrator to upload workflows or something else that I know nothing about.
I have asked the SharePoint administrator and he won't be able to get back to me until next week as he is at a conference, but I would like to try the workflow out and see if it works or I need to go back and work on it more.
If the consensus is I need more rights and I will have to wait until next week, is there a way to run the workflow in SPD or can I download my site as a sandbox and just play with it there?
Any and all help is gratefully appreciated.
For others who have this issue, it was a rights issue. The company did not install SPD as an admin, hence I could not create work flows.

SharePoint workflows cannot automatically start

I'm trying to make a SharePoint workflow start automatically for any new document that is uploaded to a specific doc library. I've configured the workflow in SharePoint Designer to auto start for new documents or changed documents. However, the workflow never starts automatically! I can run it manually, but it won't execute itself.
I've searched around and have found the core issue, which is reflected in my log:
"Declarative workflows cannot automatically start if the triggering action was performed by System Account. Canceling workflow auto-start."
However, all the fixes I've seen have not worked for me. A common solution is to not run or create the workflow as the SharePoint System Account. Well, my SharePoint service accounts are not the ones I'm logging in as to upload my documents nor was it the one I used to create the workflow. I've tried editing & re-publishing my workflow as a totally new account and it still won't auto-start.
Just focus on two things:
Workflow will never start automatically with system account.
Check the options Start workflow automatically when an item is created or changed from Workflow Start Options.
While publishing the workflow, u need to select the checkbox Start workflow automatically when an item is created or changed for the workflow to start automatically or else whatsoever the WF will not start automatically.
Instead of using Sharepoint system user account, u could use an account having contribute permission on site level and full control over the library
Run the command at the server in powershell
stsadm.exe –o setproperty –propertyname declarativeworkflowautostartonemailenabled –propertyvalue yes
After I did that, the workflow runs perfectly although it shows the created by as being "system account".

Archiving existing task list in Sharepoint 2010 without using Sharepoint Designer

I have an internal team SharePoint site where the team posts tasks in a task list. Once the task is completed, it is marked COMPLETED. I want to create a workflow so that when I change the status of a task to COMPLETED, the task is removed from the list of team tasks and moved to a new folder/list where all the completed tasks are going to be tracked.
Now, I know I can do this easily using SharePoint Designer by creating a workflow for the team tasks and then applying an equal condition on the status. However, our organization currently doesn't have the ability to use SharePoint designer and the feature is disabled.
How do I achieve the same functionality just by using the on-site features and settings. Any suggestions? I was able to add workflow but I can seem to find the equal condition.
The most straightforward way to solve the problem of separating completed and uncompleted tasks is simply to use views based on the task status.
If you MUST move the item to a different location, you can research if Records Management features get you part way, but chances are you'll need to use a tool or write code.

Getting "task is currently locked" error for SharePoint Workflow created with SharePoint Designer

I am creating a simple workflow using SharePoint Designer that triggers when a user uploads a new Document to a library. This workflow assigns a task to multiple users and then waits until those tasks are complete. Once they are complete it then assigns another task to different users and then waits until those tasks are complete. It repeats this multiple times.
This works great, the problem is that there is no Due Date on the tasks created and they would like a reminder email. Following the Microsoft Documentation I create a secondary workflow on the Task library and set a Due Date on the tasks based off of the Title and send out the reminder.
When I attempt to complete the assigned tasks, it lets me complete the task for one of the users, but after that I receive a "This task is currently locked by a running workflow and cannot be edited" message.
The sharepoint site is part of the Microsoft hosted services, so I have no controll over patches or hotfixes. I believe that it is only a WSS site, not MOSS.
I am new to SharePoint, so any fixes, workarounds, advice, etc. would be appreciated.
This blog by Wouter might clarify things for you...
http://blogs.code-counsel.net/Wouter/Lists/Posts/Post.aspx?List=c04a88a9-d138-4ac3-a2bb-b95c9fdd114e&ID=118
Also, if you are using SP 2007 make sure you have at least installed SP2.

How to force SharePoint tasks to be editable by "Assigned To" only?

We are using the default Task list from a Team Site and would like to only allow those that the Task is "Assigned To" to edit the tasks. How do you go about enforcing this?
When we tried the "Advanced Settings", we found that "Only their own" meant only those tasks created by the current user.
It looks like you need to create an event handler that updates the permission on the Task everytime the assigned user is changed.
Quite a few people have had this problem in the past.
Check out this site for an example of the problems people have had. That said it should work out-of-the-box if you copy content when setting up the Task List.
Looks like, an event handler is the way to go. I found this page in some of my searching and it explains a lot of the problems related to this issue:
Email Notifications and Alerts - Sharepoint Tasks List
Unfortunately, the client wants no custom code and wanted SP Designer workflows and browser based customizations only...

Resources