Meetings.CreateWorkspace

Dec 9, 2009 at 10:01 AM

Hi,

Benn using SPServices for a couple of weeks now and it's been saving me loads of time - Thanks.

Have you thought of including Meetings.CreateWorkspace?

Cheers

 

Andrew

Coordinator
Dec 9, 2009 at 2:48 PM

I've never had anyone ask, but it shouldn't be much work to do so.  Are you interested in any of the other Meetings Web Service operations?
http://msdn.microsoft.com/en-us/library/meetings.meetings_methods.aspx

Once I add the Meetings Web Service, the additional operations are easy.

M.

Dec 9, 2009 at 3:28 PM

Hi, thanks for the quick response.

The ones most interested in other than CreateWorkspace would be SetWorkSpaceTitle, AddMeeting and RemoveMeeting.

Cheers

Andrew

 

Coordinator
Dec 9, 2009 at 7:12 PM

Andrew:

On my list for v0.4.7.  I may have a new alpha for you soon, so watch for it: http://spservices.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=36650  If you follow @jQSPWS on Twitter, you can stay up to date as well.

M.

Coordinator
Dec 9, 2009 at 7:13 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Dec 9, 2009 at 9:45 PM

v0.4.7ALPHA6 now has the Meetings Web Service included with the four operations you requested:
http://spservices.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=36650

I have *NOT* tested this, but the code "compiles" in that my standard test pages load fine.  I'd appreciate any tire kicking that you could do for me.  All part of the community effort!

M.

Dec 10, 2009 at 8:33 AM

Great Stuff, will have a look at it today. Do follow you on twitter!

Coordinator
Dec 10, 2009 at 2:08 PM

Great. Let me know what you find.  I'll be trying to do some testing today, but since you actually want to *use* it, that'll be a far better set of tests.

M.

Dec 10, 2009 at 2:13 PM

Hi,

The createWorkspace option is working great - Thanks.

Did have some issues, but they were all mine...

Did update the work item, will put all comments against there from now on.

Thanks Again

Andrew

Coordinator
Dec 10, 2009 at 2:27 PM

Cheers.  Codeplex's alerts don't seem to be working, so I didn't see your comments on the work item.

M.

Feb 15, 2010 at 2:38 PM

Hi, thanks for such a wonderful library. Recently, I have found an issue with my code, and was wondering if you could help.

I'm using the createWorkspace to create a new site:

E.g:

$().SPServices({
    operation: "CreateWorkspace",
    title: siteTitle,
    templateName: "MySiteTemplate.stp",
    lcid: "1033",
    async:false,
    timeZoneInformation: timeZone,
    completefunc: null
});

But I also want to get the groups and permissions inherited from the webURL site. How can I replicate the "inherit permissions of parent" checkbox when creating a new site?

Thanks,

Robert

Coordinator
Feb 15, 2010 at 3:33 PM

Robert:

I would think that the Meeting Workspace would inherit permissions from its parent by default.  What permissions are being applied?

It may be a matter of calling the Permissions Web Service to update the permissions after site creation.  I notice that I haven't wrapped the Permissions operations other than GetPermissions, though.  I should get on that.  ;+)

M.

Feb 15, 2010 at 4:58 PM

Thanks for the reply.

It inherits the groups, but not the permissions. The permissions that I'm using are the default ones (approvers, designers, hierarhcy managers, site members, site owners, etc. etc.), but in the newly created site, none of them exist (only the user that created the site has full control, but that's it). Any ideas?

Regards,

Robert

Coordinator
Feb 15, 2010 at 5:03 PM

It sounds like you need the UpdatePermissions operation.  Take a look and let me know what you think:
http://msdn.microsoft.com/en-us/library/permissions.permissions.updatepermission.aspx

I've been meaning to "wrap" them, anyway, so I can get them into the next alpha for v0.5.1 for you.

M.

Feb 15, 2010 at 5:18 PM

Cool.

I'll give it a try and let you know how it goes.

Regards,

Robert

Coordinator
Feb 15, 2010 at 5:20 PM

I don't have UpdatePermission in the library yet, but I can add it for you.

M.

Feb 15, 2010 at 11:57 PM

I'll be more than happy to test it.

Thanks,

Robert

Coordinator
Feb 16, 2010 at 3:53 PM

Robert:

You'll probably notice that I released v0.5.1 today.  I didn't include the additoinal Permissions operations in this release because I'm heading out on vacation tomorrow and I didn't want to saddle my pal webdes03 with any undue complications.  (Thankfully, Mike will be monitoring things for me while I'm gone.)

I'll try to get an alpha v0.5.2 out for you before I go with UpdatePermission, but I won't promise that I'll get it done.  If not, I've got it on my list for when I return.

M.

Feb 22, 2010 at 8:45 PM
Edited Feb 22, 2010 at 8:46 PM

Thanks Marc. Hope you enjoy your vacations!

I think I figured it out. The permissions were not in the new site to begin with, so instead of UpdatePermission, I needed AddPermission or AddPermissionCollection. I took the liberty of dirtying your fantastic library with a few lines of code (check below), and haven't tested the changes throughly, but it seems to work. Here is an example:

 

E.g. Let's say that you created a site in "/Projects/2010/00001" and you want to inherit/update the groups permissions from the "/Projects" site (or site collection). Here is the snippet:

                   
                    var permissionsInfoXML="";
                    //get the permissions from the /Projects site into the newly created site
                    $().SPServices({
                        webURL: "/Projects",
                        operation: "GetPermissionCollection",
                        objectType:"Web",
                        completefunc: function (xData, status) {
                            $(xData.responseXML).find("Permission").each(function() {
                                permissionMask=$(this).attr("Mask");
                                groupName=$(this).attr("GroupName");
                                permissionsInfoXML+="<Group PermissionMask='"+ permissionMask +"' GroupName='"+ groupName+"' />";
                            });
                            
                            //Update the Permissions
                            if (permissionsInfoXML!=""){
                                $().SPServices({
                                    webURL: "/Projects/2010/00001",
                                    operation: "AddPermissionCollection",
                                    objectType:"Web",
                                    permissionsInfoXml:"<Permissions><Groups>"+permissionsInfoXML+"</Groups></Permissions>",
                                    completefunc: function (xData, status) {
                                             alert("yey!");
                                        }
                                });
                            }
            
                        }
                    });

 

What I changed:

To keep it consistent, I extended the library with the following:

    // Added to the Array to store Web Service / operation associations  (Around line 85)

    WSops["AddPermission"]                            = PERMISSIONS;
    WSops["AddPermissionCollection"]                = PERMISSIONS;
    WSops["UpdatePermission"]                        = PERMISSIONS;

     // Added to PERMISSION OPERATIONS (around line 375)

         case "AddPermission":
                SOAPEnvelope.payload += wrapNode("objectName", opt.objectName);
                SOAPEnvelope.payload += wrapNode("objectType", opt.objectType);
                SOAPEnvelope.payload += wrapNode("permissionIdentifier", opt.permissionIdentifier);
                SOAPEnvelope.payload += wrapNode("permissionType", opt.permissionType);
                SOAPEnvelope.payload += wrapNode("permissionMask", opt.permissionMask);
                break;
            case "AddPermissionCollection":
                SOAPEnvelope.payload += wrapNode("objectName", opt.objectName);
                SOAPEnvelope.payload += wrapNode("objectType", opt.objectType);
                SOAPEnvelope.payload += wrapNode("permissionsInfoXml", opt.permissionsInfoXml);
                break;
            case "UpdatePermission":
                SOAPEnvelope.payload += wrapNode("objectName", opt.objectName);
                SOAPEnvelope.payload += wrapNode("objectType", opt.objectType);
                SOAPEnvelope.payload += wrapNode("permissionIdentifier", opt.permissionIdentifier);
                SOAPEnvelope.payload += wrapNode("permissionType", opt.permissionType);
                SOAPEnvelope.payload += wrapNode("permissionMask", opt.permissionMask);
                break;

 

Thanks,

Robert

Coordinator
Mar 1, 2010 at 9:19 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Mar 1, 2010 at 9:20 PM

Robert:

Thanks for posting what you ended up doing.  I've copied your post to an Issue Tracker item, and I'll try to get it into the next release.

M.

Coordinator
Mar 2, 2010 at 8:40 PM

Robert:

I'm going to be posting a new alpha later today with the Permissions operations above. You can track this here:
http://spservices.codeplex.com/WorkItem/View.aspx?WorkItemId=5478

I'd appreciate any testing which you could do for me.

Thanks,
M.

Mar 5, 2010 at 9:48 AM
Edited Mar 5, 2010 at 9:49 AM

Robert - I see in your example call to CreateWorkspace that you use a variable 'timeZone' for the timeZoneInformation parameter. Could you tell us how you have generated this variable as it appears to be a complex type with several subelements and obligatory according to the WSDL.

Thanks

Mar 8, 2010 at 9:00 PM

Thanks Mark, I'm working on some features for a related project, but as soon as I have some time, I'll help you with testing. Looks good so far tho :)

Mar 8, 2010 at 9:29 PM
Edited Mar 8, 2010 at 9:34 PM

Sup devincase,

Yeah, the timezone variable is fairly complex...but in my tests, I've seen that as long as it is compliant with the WSDL, it doesn't really matter what you put in it (unless you are creating a workspace instead of a site). In other words,  you need to pass something in the timezone string, but it's not used.

So, if you are only creating sites, and not workspaces, perhaps you can cheat a little and hardcode a constant that is good enough to pass the webservice call. In my case I used this string:

 

var timeZone = "<bias>0</bias><standardDate><year>2009</year><month>12</month><dayOfWeek>3</dayOfWeek><day>10</day><hour>08</hour><minute>57</minute><second>30</second><milliseconds>1</milliseconds></standardDate><standardBias>2</standardBias><daylightDate><year>2009</year><month>10</month><dayOfWeek>1</dayOfWeek><day>20</day><hour>02</hour><minute>0</minute><second>0</second><milliseconds>0</milliseconds></daylightDate><daylightBias>1</daylightBias>";

 

Hope it works for you.

 

Mar 9, 2010 at 9:11 AM

Thanks Robert and Marc.

Finally got everything working - turns out I'm not too old to forget to check the case-sensetivity of the parameter names - I had 'templatename' instead of 'templateName' so the webservice was defaulting to the meeting template.

So just to confirm - you can create any kind of subsite using this method, be it standard (STS#0) or a custom template from the site template gallery (testtemplate.stp)

To make up for such a rookie mistake if anyone is looking to control the version number of a file in a library through the web services you can do a check-out and check-in using the Lists web service.

The CheckInFile method allows you to overwrite the same version, increment minor version or increment major version with the CheckInType parameter.

Yet another little function Microsoft decided to hide away.

Coordinator
Mar 9, 2010 at 12:45 PM

devincase:

Glad you got it working.  If I had a penny for every typo that's caugfht me over the years...

That versioning thing sounds like a nice trick.  I'll have to take a look at that.

M.