Share via


Creating Workspaces

There are four ways to create workspaces using GrooveSpaces:

  • Create an empty workspace with the Create operation.

  • Create a workspace using a Groove Workspace Template or Archive with the CreateFromGSA or CreateFromGSAByRef operation. A Groove Workspace Template is a binary file with a .GSA file type that is created when a member saves a workspace to a template or archive using the Groove user interface. A template typically does not contain the tool data where an archive does. The CreateFromGSA operation passes the contents of the .GSA file as a parameter, where the CreateFromGSAByRef specifies the .GSA file as a file path on the local device.

  • Create a Groove File Sharing Workspace with the CreateGrooveFileSharingSpace operation.

Create a workspace with the Create, CreateFromGSA or CreateFromGSAByRef operation. There are advantages to each:

  • If you are creating an empty workspace with no tools, use the Create operation since it is easier to use.

  • If you need to create a workspace where the tools are created with data, you must use the CreateFromGSA or the CreateFromGSAByRef operation since the Create operation can only create an empty workspace.

If you are making a remote Groove Web Service call to a Groove Data Bridge, the GSA file must be a local file on the Groove Data Bridge in order to use it in a CreateFromGSAByRef operation.

If you are creating a workspace with the Create operation, you specify the workspace name and description in a Space object. The following code creates a GrooveSpaces service, creates a new Space object, and assigns the workspace name and description. Note that you must set the Create operation CSTURI parameter to an empty string since all other values are reserved for future use.

GrooveSpaces.GrooveSpaces spacesSvc = new GrooveSpaces.GrooveSpaces();
...

GrooveSpaces.Space createSpace = new GrooveSpaces.Space();
createSpace.Name = "New space";
createSpace.Description = "New space";

string spacePostURL = spacesSvc.Create(createSpace, "");

The following example code demonstrates how to create a workspace from a GSA. It reads the contents of a GSA file into a stream, then calls CreateFromGSA, and finally reads the newly created space with ReadSpace. The code would be simpler if you used CreateFromGSAByRef, but if you are making a remote Groove Web Service call to a Groove Data Bridge and the GSA is not on the Groove Data Bridge device, then you must pass it in as a parameter.

using System.IO;
...
// Create GrooveSpaces service 

// Read the GSA from a file into a byte array
string gsaPath = "c:\\temp\\TestSpace.gsa";
FileStream fStream = new FileStream(gsaPath, System.IO.FileMode.Open);
int streamLen = (int) fStream.Length;
byte[] gsaBuffer = new byte[streamLen];
BinaryReader bReader = new BinaryReader(fStream);
gsaBuffer = bReader.ReadBytes(streamLen);
bReader.Close();

// Create the space
string createdURI = spacesSvc.CreateFromGSA(gsaBuffer, 
  "Test Space From GSA","");

// Reset the HTTP Post URL for the new space and then read it
spacesSvc.Url =  HTTPAddressAndPort + createdURI;
GrooveSpaces.Space newSpace = spacesSvc.ReadSpace();

If you are creating a File Sharing Workspace, you specify the workspace name and in a separate parameter rather than in a Space object. In addition, you specify the Windows folder to use for the File Sharing Space. You must ensure that the folder exists before calling the operation. If the folder does not exist, the folder is the root folder of the device, or the folder is on a removable drive, the operation fails and returns a SOAP fault.

See Also

Reference

GrooveSpaces Web Service

Concepts

Reading Workspaces
Updating and Deleting Workspaces
Accessing Tools in a Workspace