This page is now retired and kept for archival purposes. This programming guide has been published on MSDN at http://msdn.microsoft.com/library/jj643273.aspx

This article is part of the Service Provider Foundation Programmers Guide (SPF).

Virtual Machine Checkpoints provide a way to capture the state of a Virtual Machine. The Checkpoint can then be used to restore the Virtual Machine back to the way it was when the Checkpoint was created.

Sometimes though, a checkpoint may no longer be needed and you may want to delete it. This is completed using the standard OData method of deleting a resource. A checkpoint is deleted by calling the DELETE HTTP operation on the checkpoint identified by the URL.

To delete a checkpoint with .NET

  1. Connect to the Service Provider Foundation VMM service.

  2. Obtain reference to the specific SpfVMM.VMCheckPoint you want to delete.

  3. Call the DeleteObject method on the VMM service object reference and pass in the checkpoint reference.

  4. Call the SaveChanges method on the VMM service object reference.

To delete a checkpoint with HTTP

  1. Create a new HTTP DELETE operation.

  2. Set the URL to the VMCheckPoints collection, identifying the checkpoint to delete. For example: https://server:30005/subscription-id/services/systemcenter/vmm/VMCheckPoints(ID=guid'a11cc636-5521-4f88-92b2-cad392911fe0',StampId=guid'ba4146fa-fb41-4f59-a193-ad00c52a138c').

  3. Add the HTTP headers.

    Specifically, add the x-ms-principal-id header, which can be set to any value.

  4. Submit the HTTP request.

Example

The following example shows how to delete a Virtual Machine Checkpoint using .NET. For more information, see Programming in Visual Studio with Service Provider Foundation Services.

SpfVMM.VMM vmmService = new SpfVMM.VMM(new Uri("https://wapserver/:30005/97FD50F3-1DC0-41B6-A7C0-2B4FF4C3F7E3/services/systemcenter/vmm/"));
vmmService.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
 
var checkpoint = vmmService.VMCheckPoints.Where(cp => cp.ID == new Guid("3499b02c-8dc9-4c0d-aa83-097a1340cbda")).FirstOrDefault();
 
if (checkpoint != null)
{
    vmmService.DeleteObject(checkpoint);
    vmmService.SaveChanges();
}

The following is an example HTTP request sent to the server:

DELETE https://wapserver:30005/97FD50F3-1DC0-41B6-A7C0-2B4FF4C3F7E3/services/systemcenter/vmm/VMCheckPoints(ID=guid'a11cc636-5521-4f88-92b2-cad392911fe0',StampId=guid'ba4146fa-fb41-4f59-a193-ad00c52a138c') HTTP/1.1
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
DataServiceUrlConventions: KeyAsSegment
User-Agent: Microsoft ADO.NET Data Services
x-ms-principal-id: user@contoso.com
Content-Type: application/json;odata=minimalmetadata
Host: wapserver:30005
Content-Length: 0

The following is an example HTTP response from the server:

HTTP/1.1 204 No Content
Cache-Control: no-cache
Server: Microsoft-IIS/8.5
x-ms-request-id: 7ce34b7f-81a1-40e6-a3bf-12b84995cf74
X-Content-Type-Options: nosniff
request-id: eda9bde6-834a-0001-9808-abed4a83ce01
DataServiceVersion: 1.0;
X-AspNet-Version: 4.0.30319
Persistent-Auth: true
X-Powered-By: ASP.NET
Date: Mon, 19 Aug 2013 22:17:52 GMT