Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am a new developer in SharePoint and I developed a visual web part. I want to add a approval mechanism for my visual web part form.

For example if user clicks the button(which I created in visual web part) the e-mail should be sent.

Is it possible to create such kind of workflow and if yes, how can I do that?

share|improve this question

1 Answer 1

The short answer on your question could be following. You can do what you wrote, but it is not that you normally do in SP and workflows in SP work in different way.

Most likely, you understand types of workflow in SP incorrectly. You can't write workflow on a form. Usually you create WF which should be run on some items in a list or a library.

For instance it could work as follow:

  • Step 1. You created WF ("Approve absence") associated with some list ("Absence requests" for example).
  • Step 2. Somebody (for example, John) adds new Absence request (by filling in some form). In this form he could show when he wants to go on vacation.
  • Step 3. John starts the "Approve absence" WF by selecting his request -> pressing Workflows button on the ribbon -> pressing "Approve absence" link.

After that your WF starts and it can send emails, assign tasks and so on. The main point here is that you should start workflow on some item. Usually you don't need to make start of the WF by pressing some button inside your Visual WebPart (they are used to show some information).

So possibly you could start from reading some articles to understand how WFs work in SP. You can start here to understand what types of workflow could be. After that (or even before :) you can create your own HelloWorld list workflow using SharePoint Designer. There are a lot of walkthrough tutorials about it. It seems that this one is suitable.

PS: Creating WF in Visual Studio is very complex task and should avoid it at least on the first stage (it can take several months of hard studying to understand it).

PPS: Some books you can read:

  • SharePoint 2010 Workflows in Action
  • Professional Workflow in SharePoint 2010
share|improve this answer
    
Thanks for your reply. But I know these steps I think I couldnt express the thing that I need. I wanted to create a workflow which is connected with the visual web part. –  sultannur can Dec 25 '12 at 12:36
    
I am not 100% sure, but I think it is impossible using SP WF's. You can try to implement it using your code-based web part and your own code in the code-behind. In such a case you could send emails and do what you want, but possibly it is not what you need. –  MikhailSP Dec 25 '12 at 12:53
    
msdn.microsoft.com/en-US/library/ee231580.aspx is the thing which I was looking for. Thanks 4 your help –  sultannur can Dec 25 '12 at 15:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.