Skip to content

Instantly share code, notes, and snippets.

@gscales
Last active March 4, 2026 11:23
Show Gist options
  • Select an option

  • Save gscales/11f0006d3023a12e237fab6c2c289e41 to your computer and use it in GitHub Desktop.

Select an option

Save gscales/11f0006d3023a12e237fab6c2c289e41 to your computer and use it in GitHub Desktop.
private static readonly Guid PSETID_Note = new Guid("{0006200E-0000-0000-C000-000000000046}");
Item note = new Item(service);
note.ItemClass = "IPM.StickyNote";
// 3. Set basic content
note.Subject = "My EWS Sticky Note";
note.Body = "This is the content of the sticky note.\nCreated via EWS Managed API.";
// 4. Define Extended Properties (based on MS-OXONOTE spec)
// PidNameNoteColor: 0=Blue, 1=Green, 2=Pink, 3=Yellow, 4=White
ExtendedPropertyDefinition noteColor = new ExtendedPropertyDefinition(PSETID_Note, 0x8B00, MapiPropertyType.Integer);
// Dimensions and Position (optional, but part of the spec)
ExtendedPropertyDefinition noteWidth = new ExtendedPropertyDefinition(PSETID_Note, 0x8B01, MapiPropertyType.Integer);
ExtendedPropertyDefinition noteHeight = new ExtendedPropertyDefinition(PSETID_Note, 0x8B02, MapiPropertyType.Integer);
ExtendedPropertyDefinition noteX = new ExtendedPropertyDefinition(PSETID_Note, 0x8B03, MapiPropertyType.Integer);
ExtendedPropertyDefinition noteY = new ExtendedPropertyDefinition(PSETID_Note, 0x8B04, MapiPropertyType.Integer);
// Set the property values
note.SetExtendedProperty(noteColor, 3); // Yellow
note.SetExtendedProperty(noteWidth, 200);
note.SetExtendedProperty(noteHeight, 150);
note.SetExtendedProperty(noteX, 100);
note.SetExtendedProperty(noteY, 100);
// 5. Save the note to the default Notes folder
note.Save(WellKnownFolderName.Notes);
Console.WriteLine("Sticky Note created successfully!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment