New-MapiItem

Description

Creates a new, empty item in a specific folder, optionally with a subject and message class.

Syntax

Note: Parameters in orange are optional.

New-MapiItem
-FolderMapiObject<Mapi.NET.Folder>
-ItemTypeToCreatePowerMapi.Commands.CreateItem.ItemTypes
-ItemClassString
-SubjectString

 

Parameters
FolderThe Mapi.NET.Folder in which to create the new item.  A instance of this object can be retrieved using Get-MapiFolder
ItemTypeToCreateOne of the values from PowerMapi.Commands.CreateItem.ItemTypes
  • Normal
  • Associated
ItemClassA string value that defines the type of item.  When this parameter is not present, it defaults to 'IPM.Note' (standard message).  There are many item types with the most common being
  • IPM.Note - The standard message type
  • IPM.Appointment - A calendar item
  • IPM.Task - A task item
  • IPM.Contact - A contact item
  • IPM.StickyNote - A 'post-it' note item
SubjectA optional string value that is set as on the new item's 'PR_SUBJECT' property.
Remarks

This cmdlet creates a new item in the specified folder.  The new item is empty by default, except if the subject and/or item class parameters are used.

Once created, the use of New-MapiProp and Set-MapiProp can be used to set a series of attributes on the new item.  Using Add-MapiRecipient can add TO, CC, and BCC recipients.  Not all properties are writable on an item, for example the PR_MESSAGE_SIZE property is a calculated, read-only attribute and attempting to set such a value will throw an error.

The ItemTypeToCreate parameter allows for the creation of Associated items, which are items that are associated with a folder, but are not display to clients.  Outlook and Exchange use associated items to store configuration details, rules, OOF, and other configuration data.

Note that creating a new item does not automatically cause it to be saved into the folder, but is instead in a temporary state until Set-MapiProp is called on the new item at least once.  Set-MapiItem will call the underlying mapi 'SaveChanges' method on the item, and if successful, publishes the new item in the folder.