In my previous entry about Live Mesh I mentioned that you could use it to transfer data to and from the cloud in addition to straightforward file-sync operations.
To develop Mesh enabled applications you need to sign up to the Mesh developer site, but this is straightforward. You do need to remove the Live Mesh client to install the Live Framework Client and connect to https://developer.mesh-ctp.com rather than http://www.mesh.com, but presumably this will be rectified for final release You can download the SDK from here.
In the Live Framework SDK there are samples to demonstrate Mesh functionality. The Live Folders sample creates, edits and deletes files from the Mesh. These files and folders appear exactly the same as the synchronized folders created with Live Mesh. I would expect that long term you could synchronize with these folders, but at the moment the Live Framework Client is sandboxed and does not support the synchronization or remote control features of Live Mesh.
The following code creates a Live Mesh folder and you can see that the resource type is LIVE_MESH_FOLDER:
public static string CreateRootFolder(Mesh mesh, string title)
{
// Check if a folder with the same name exists.
foreach (MeshObject oneObject in mesh.MeshObjects.Entries)
{
if (oneObject.Resource.Title.Equals(title))
{
return "Folder already Exists!!!";
}
}
// Create folder object
MeshObject meshObject = new MeshObject(title);
// It is a mesh folder
meshObject.Resource.Type = MeshConstants.LIVE_MESH_FOLDER;
// Add folder to collection of mesh objects
mesh.MeshObjects.Add(ref meshObject);
// Create feed for files (required)
DataFeed fileDataFeed = new DataFeed(MeshConstants.LIVE_MESH_FILES);
// Set type and handler type (required)
fileDataFeed.Resource.Type = MeshConstants.LIVE_MESH_FILES;
fileDataFeed.Resource.HandlerType = MeshConstants.FILE_HANDLER_TYPE;
// Add new data feeds to collection
meshObject.DataFeeds.Add(ref fileDataFeed);
//this.LoadMeshObjects();
return "Root folder " + title + " created successfully";
}
There is also a Project Manager sample in the SDK. This is a simple application to create projects and milestones. It creates non-standard objects in Mesh. As you can see in the project code below, you can create your own class of object and are not constrained by standard folders and files:
///
///
[DataMember]
public string MOID { get; set; }
///
/// but is stored here when the custom object is databound instead of the resource)
///
[DataMember]
public string Title { get; set; }
///
///
[DataMember]
public DateTime KickOffDate { get; set; }
///
///
[DataMember]
public DateTime CompletionDate { get; set; }
///
///
[DataMember]
public DateTime ShippedDate { get; set; }
///
///
[DataMember]
public string Description { get; set; }
When you deploy a Mesh application it appears both on the users Live Mesh website and also as a shortcut on their desktop. In this way, a user can just run the app without any knowledge of Live Mesh. Furthermore, because the data is synchronized between the local machine and the cloud, they can run the application when they are disconnected and it will automatically synchronize when connected although there is no conflict resolution built in.
In the code samples above, these are just snippets of the complete solution, but you can see that Live Mesh has both straightforward user file and folder synchronization, as well as an API to enable you to create a cloud-based solution.
As a final note, I looked into this as a way to synchronize favorites in IE8. You can now do this by signing up to SkyDrive and reinstalling the Live Toolbar.