Jun 9, 2012

Released: Sandboxed SharePoint Workflow Actions

Hey guys, I’m happy to announce that I published a first release of some sandboxed workflow actions! The first version includes the highly desired “Create Site”, “Create Group” and “Add User to Group” actions. With this set of actions you can easily create new sites and assign permissions to them. And the best thing is, this works in Office 365 too!
You can download the solution here.

Install the Sandbox Solution

  1. Go to “Site Settings”->”Solutions”
  2. Upload the solution “iloveSharePoint.Sandbox.WorkflowActions.wsp”
    image
  3. Activate the solution
    image
  4. Ensure that the “iLove SharePoint Sanboxed Workflow Actions” Site Collection Feature is activated.
    image
  5. Open SharePoint Designer and check that the new actions are available. You can find the actions only within an impersonation step!
    image

    image
  6. Done.

Create Site Action

This action creates a new sub website. It requires the following parameters:

  • URL: Leaf name for the new site e.g. “subsite1”
  • Title: Title of the new site.
  • Description: Description of the new site
  • Template: Template for the new site. You can either specify the name (e.g. “STS#1”) or the title (e.g. “Team Site”)
  • Language: The language code for the new site (e.g. 1033=English). If you specify 0 or –1 it will inherit the language from the parent site.
  • Inherit Nav: Specifies whether the new site will use the same navigation as the parent site or not.
  • Top Nav: Specifies whether the new site will be add to the top link bar of the parent or not.
  • Quick Nav: Specifies whether the new site will be add to the quick launch of the parent or not.
  • Unique Permissions: Specifies whether the new site will have unique permissions or not.
  • Output: Url of the new site
  • Error: If an error occurs the workflow will not fail. You have to check if the error variable is empty or not!

image

image

Create Group Action

The create group action allows you to create SharePoint groups from within workflows. With this action you can easily create new groups in sites that you have created with the “Create Site” action. The action requires the following parameters:

  • Group Name: Name of the new group.
  • Site: Absolute Url of the the site. If you leave this parameter empty, the group will be added to the current site. Although you specify an absolute url of a site this action only works within the current site collection! You can use the output url of the Create Site action here.
  • Owner: Owner of the new group.
  • Description: Description of the new group.
  • Permissions: Permission for the new group. One line per permission level.
    image
    image
  • Error: If an error occurs the workflow will not fail. You have to check if the error variable is empty or not!

image

image

Add UserS to Group Action

With this action you can add users to a group. The action requires the following parameters:

  • Users: The users to add to the group
  • Group Name: Name of  the group to add the users.
  • Error: If an error occurs the workflow will not fail. You have to check if the error variable is empty or not!

image

image

54 comments:

El Anonimo said...

very happy with this one, hope you get the chance to add some functionalities. Great!

Brandon Showers said...

This looks very promising. I hope the next version will have the execute powershell action.

Anonymous said...

Hi,

Thanks for the solution. I am trying to use your solution to automatically create a site with Unique permission.
It is working great!. I am also using create group action to create a group in the newly created site.

After creating a site and groups, If i choose share site option, i am getting the message,
"The groups required to manage users for your site are missing".

Share site option is looking for AssociatedOwnerGroup, AssociatedMemberGroup and AssociatedVisitorGroup.


My question is, How do i map the newly created group to the above mentioned group?

Please let me know.

Christian said...

Hi,

good point. I think this currently not possible. I guess I've to extend the create group action with a parameter to associate the new group with one of the above mentioned groups. What do you think?
Bye,Christian

Anonymous said...

Excellent tool. Doing a snoopy dance, because you saved me lots of time.

zula said...

First of all i have to congratulate you for the wonderfull job you do.
I have test your activities and they work wonderfully.
Do you will provide source code?
I´m really want to use your activities in our productive enviroment, but my organization only permit that if we have the source code of what we use.
If you can´t provide, can you help me creating this activities. Indicate me a good tutorial to create a group activity.

I am eagerly awaiting a response from you.

Greetings,

Carlos.

Christian said...

Yes, source code is available. Check out the source code tab on the codeplex project.
Bye, Christian

zula said...

Hi Christian,

First of all, thanks to respond my post.
I download the source code, but when open de .zip give me an error ("the compressed (zipped) Folder is invalid").

Can you verify this please.

Hug,

Carlos

Fia lia said...

It looks very nice! greatwork.

I got a question but does this also work with sharepoint 2007 and SPD2007.

Im asking cause in the manual i see that u have to create an 'impersonation step' which is an option i cant find in SPD2007.

Christian said...

Fia lia, the actions will only work in SharePoint 2010.

Christian said...

Carlos, the zip gets generated by codeplex. Maybe they have an temorary issue.

Anonymous said...

I'm getting confused with the numbers: 100.000 million SharePoint licenses, 10.000.000 million non SharePoint developers world wide?

Christian said...

LOL you are right. That would be much. Have to kill some nulls or the millions. Thx

Amsterdaz said...

Hi

Can you tell me how (in SharePoint 2010) to do step 4?

Amsterdaz said...

Never mind; I've sorted it. Now for some testing. Thanks for the post.

Amsterdaz said...

I Love iLove SharePoint! This has saved me so much time or, more probably, having to work out an alternative solution.

Ali said...

hi
Problemm!!! =((

ı do all step but when ı come 5.
there is no action ilove sharepoint
pls help me what ı sould do ???

Florian said...

Hey everbody
I have the following problem: I use the create site action based on a sharepoint form library. The library contains InfoPath files with some basic information in it. After creating such an InfoPath file, I want to start the workflow to create a site based on information out of the infopath. For example, the URL for create site is defined as "CurrentItem:Metaname". Metaname is a field of my infopath file. If I start the workflow everything is fine and it says "completed". But now my problem: no site gets created. It simply does nothing.

I tried a lot of different things, but I can't find my mistake, can you guess what am I doing wrong?

Anonymous said...

The solution works great, thank you very much!

However, i can't get it to create the site using a custom template, the site creation process hangs at the "Select a Template" step, as if it doesn't recognize my custom template.

I can then manually select my custom template, and it works fine.

Is there something else I need to do to get it to use the template specified and complete the process on it's own?

Anonymous said...

Nevermind, I found the answer. Template names are case sensitive.

What an awesome solution!!! Thank you so very much!

Nina Henry said...

You show here the steps of install sandbox solution which will quite helpful to the fresher who are looking for.

Anonymous said...

realy happy with this solution, there is only one problem. I can,t add more than one User at a time to a group. i try to do it with the InitiationformularParameters in Sharepoint Designer 2010. I'm getting it to work with one User but the workflow won't run trough for more users.. Any ideas how i have to config this in SPD2010?

Greetz

Jeremy Hamilton said...

Is there any way to use this to REMOVE users from a group????

Christian said...

Unfortunately, there isn't a remove action.
Bye, Christian

Anonymous said...

When i try to activate iLove SharePoint - SharePoint Designer 2010 Workflow Actions in the site collection, I get this error:

NOSCOPE
The feature you are trying to activate is dependent on another feature $Resources:FeatureTitle contained in the solution 00000000-0000-0000-0000-000000000000 which is not installed.


Any ideas?

Thanks!
Scott

Dave said...

Hi. I am having trouble adding multiple users to a group. I am doing a lookup to a multiple "person or group" field and have tried all of the "return value as" options: "string" and each kind of "semicolon delimited" option. Does this workflow only add one user at a time or is there something I'm overlooking? Thanks!!

Anonymous said...

Hi,

I have a small question. Does it works with SharePoint 2013 ?

Because I try to install ILoveSharePoint on SharePoint 2013, I can add and activate the solution, but I can't find “iLove SharePoint Sanboxed Workflow Actions” in Site Collection Feature "

I try to add with command line, so : stsadm -addsolution -filename "c:\...\iLoveSharePoint.Sandbox.WorkflowActions.wsp" . No errors on command line. After that, I deploy solution on sharepoint ==> it work
But the solution is not working with VisualStudio 2012..

Is it because I have sharepoint 2013 or Visual Studio 2012 ?

thank in advance,


Benjamin


Anonymous said...

sorry is not with VisualStudio but SharePoint Designer.

thank you

Anonymous said...

sorry, it works !

Anonymous said...

Hi there,

Have you been able to test this with the new SharePoint Online using 2013 and SharePoint Designer 2013? I've been able to install everything and see the option in Designer under the 2010 mode but when I go to add an action to the Stage nothing happens, it just sits there, no error message and nothing is added to the stage. Any ideas? I would really love to see this work.

Thanks,
Andy

Vishnu said...

Hi,
I tried to use the add users action in sharepoint designer.
My requirement is I am having an Multi Valued person or group column. I am using the option "return field as Login Names,Semi colon separated".

Issue if I have 2 users A and B in the person or group column while adding to the sharepoint group it is adding only B but not A. Any reason why is this happening. Is there any work around for the same.

Anonymous said...

Hi Christian,

thanks for the Workflow actions, however I'm facing trouble with the 'Add user to group' action. I always get an system account error after starting the workflow. It could be likely that the lookup for the group parameter is not correct. Do you have an example which shows the group lookup much more detailed?
Thanks,
Joerg

Josh Hoxsie said...

Hi so i am trying to get this to work for Designer 2013 using 2010 workflow format. when i choose the "create a site" option nothing happens. other colleagues of mine it is working fine but the only difference we found was he was using 64-bit Designer 2013 and i was using 32. on Office 365

Wilson said...

I'm getting the same error as Josh. When i click "create a site" nothing is entered into the "impersonal step" im using designer 2013 64 bit.

Anonymous said...

I'm getting the same issue as Josh as well. Has anyone worked out why this is?? Very frustrating!

Cheers

Daniel

Ashish said...

Hi,
Thanks for this life saving piece of code.
But I'm facing one issue with this add to user workflow action.

Everything runs fine but users are sometimes not added to the group and sometimes they're added.

Out of n number of users provided sometimes, only one user is getting added to the group and sometimes all of them are getting added.

Could you please help me with this issue if you've ever faced it.
below is the piece of code which i'm using in my class

{
Hashtable Result = new Hashtable();
Result["error"] = string.Empty;
SPSite Site = null;
SPWeb Web = null;
try
{
using (Site = new SPSite(context.CurrentWebUrl))
{
using (Web = Site.OpenWeb())
{
SPGroup Group = Web.SiteGroups[groupName];
String[] AllUsers = users[0].ToString().Split(';');
Web.AllowUnsafeUpdates = true;

foreach (String userName in AllUsers)
{
SPUser user = Web.EnsureUser(userName);
Group.AddUser(user);
}
Result["error"] = "Success";
}
}
}
catch (Exception ex)
{
Result["error"] = ex.Message;
}
finally
{
Web.AllowUnsafeUpdates = false;
if (Web != null) Web.Dispose();
if (Site != null) Site.Dispose();
}
return Result;
}

Devang said...

Hi Christian,
i am able to activate the solution.
i am using it on sharepoint Online-Sharepoint 2013 Office 365.
the actions are there but cant add them.
menas when i am trying to add them in the step nothing happens.
Josh Hoxsie Also reported the same problem.

wil you please help.

Anonymous said...

I'm unable to add user in group using workflow option 'add users to Group'. I have tried the display name, login name, email id of a user one by one, to add into a particular group, but no luck.

This seems solution is not working in SharePoint foundation 2010. All the time I'm getting an error for with System administrator account

Do please advice on why it's not working

indranil sarkar said...

I have been getting the same error of Joerg. Do you have any idea on 'Add Users to Group' is now working or not?
I am using SharePoint Foundation 2010, I'm able to get these options in workflow under SharePoint designer but when I tried to add user in group is seem to be not working and getting an System Account error, as Joerg mentioned earlier.

Regards,
Indranil

Alex Ouretski said...

I keep getting "MyWorkflowName failed to run" when I use "Add user to group" action. Doesn't really give any details as to why the workflow failed. I am on SP2010 Enterprise. Any ideas how to troubleshoot it? The user under which the workflow was created is both Site collection admin and Site owner.

Anonymous said...

I deployed solution in solution gallery but don't see it in SharePoint designer 2010. Am I missing anything here? I followed all the step but still not luck.
Can anyone please help!

Anonymous said...

Never mind! It's working.

Thanks

Neil said...

Hi, Got this solution working on my Office365 system, to an extent.
Ive got the create group working by using [%Current Item:Title%]-Full Control.

But when I go to add a user to it if I set the name of the group eg Project-Full Control users are added and it works, but when I set [%Current Item:Title%]-Full Control no users are added to the group.

As I have not determined the site name and I want to use this on many new items created, I want to use the [%Current Item:Title%] variable.
As it has worked on other parts any reason it might not be working on the add users?

Hope this makes sense

Neil said...

Ok ignore the last thing I said its jsut sprung into life. But now when I run it the users are getting added to the new site, but now they seem to be losing there permissions on the rest of the site. Any thoughts?

Anonymous said...

Hi,
Can we create sub site under any site with this solution? I couldn't create sub site if I define who path and also get illegal character ":" error message when I provide full url.

Anyone tried to create sub site?

Thanks

Darly arun said...

Hi my self ArunDarly
I deployed wsp through power shell (Because while activation in Solution Gallery the activation button was disabled) it deployed globally at form level
and I got the feature and activate that feature but in share point designer Did not get those I love SharePoint work flow actions what is the reason? For that

Anand said...

Thanks for this great tool. Saved a lot of effort!
One issue I'm facing. The workflow is not starting automatically when an item is added to the list assciated with it. I've checked the appropriate check boxes in in SPD after workflow creation.

Appreciate your help!

-Anand

devil jiang said...

With a rough economy featuring shrinking benefits replica handbags and daily job cuts, at least evil corporations like Omni Consumer Products offer replica wathces job security. They have awesome health insurance and may even cover you beyond death if you have the right skillset like gucci replica Officer Murphy. The Delta City project seems like one of those fat government contracts that drags on for decades. Besides, they just sponsored a real-life statue of Robocop in Detroit. They can be all bad. - chanel replica Eternal Sunshine of the Spotless Mind

Jakub said...

Just spent 3h troubleshooting "Create Site" action that did NOTHING. The problem was in Language inheritance settings. Whole action completes successfully but with no result when you specify "Language 0". Only -1 works properly.

Anonymous said...

Thanks for this great tool. But I have a Problem. When I save and publish the workflow the action completes successfully and my new site is created. When I try to run the workflow at next day I get an Error. Workaround at the moment is to publish the workflow again.
Any ideas?

mara stanciu said...

Hi,

Really great tool, i want to use it, but i can't add the 'Impersonation Step'. When I open SP Designer from the SP List where i want the workflow...nothing is changed.

Can anyone help, please? I'd be very grateful!

Lots of thanks,
Mara

Gilbert Okello said...

Hi Mara,
What version of sharepoint are you using?

Tony Leary said...

Would enabling publishing prevent this from running?

Sergey Vovnenko said...

Hi,

Thanks for solution.

I have a little problem:
I create 2010 WF, add Impersonation Step. After that, in "Actions" i see 3 new actions, but cannot add them.
When i choose action - nothing happens.

Any suggestions?

Thank you