public byte[] CreateReplyTemplate(uint inboxFolderHandle, ulong inboxFolderID, bool isOOFReplyTemplate, string templateSubject, TaggedPropertyValue[] addedProperties, out ulong messageId, out uint messageHandler)
{
// Create a new FAI message in the inbox folder
RopCreateMessageResponse ropCreateMessageResponse = new RopCreateMessageResponse();
messageHandler = this.RopCreateMessage(inboxFolderHandle, inboxFolderID, Convert.ToByte(true), out ropCreateMessageResponse);
#region Set the new created message's properties
TaggedPropertyValue[] replyTemplateProperties = new TaggedPropertyValue[3];
// PidTagMessageClass
replyTemplateProperties[0] = new TaggedPropertyValue();
PropertyTag replyTemplatePropertiesPropertyTag = new PropertyTag
{
PropertyType = (ushort)PropertyType.PtypString,
PropertyId = (ushort)PropertyId.PidTagMessageClass
};
replyTemplateProperties[0].PropertyTag = replyTemplatePropertiesPropertyTag;
if (isOOFReplyTemplate == true)
{
replyTemplateProperties[0].Value = Encoding.Unicode.GetBytes(Constants.OOFReplyTemplate + "\0");
}
else
{
replyTemplateProperties[0].Value = Encoding.Unicode.GetBytes(Constants.ReplyTemplate + "\0");
}
// PidTagReplyTemplateId
replyTemplateProperties[1] = new TaggedPropertyValue();
PropertyTag pidTagReplyTemplateIdPropertyTag = new PropertyTag
{
PropertyId = (ushort)PropertyId.PidTagReplyTemplateId,
PropertyType = (ushort)PropertyType.PtypBinary
};
replyTemplateProperties[1].PropertyTag = pidTagReplyTemplateIdPropertyTag;
Guid newGuid = System.Guid.NewGuid();
replyTemplateProperties[1].Value = Common.AddInt16LengthBeforeBinaryArray(newGuid.ToByteArray());
// PidTagSubject
replyTemplateProperties[2] = new TaggedPropertyValue();
PropertyTag pidTagSubjectPropertyTag = new PropertyTag
{
PropertyId = (ushort)PropertyId.PidTagSubject,
PropertyType = (ushort)PropertyType.PtypString
};
replyTemplateProperties[2].PropertyTag = pidTagSubjectPropertyTag;
replyTemplateProperties[2].Value = Encoding.Unicode.GetBytes(templateSubject + "\0");
this.RopSetProperties(messageHandler, replyTemplateProperties);
this.RopSetProperties(messageHandler, addedProperties);
#endregion
// Save changes of the message
RopSaveChangesMessageResponse ropSaveChangesMessagResponse = this.RopSaveChangesMessage(messageHandler);
messageId = ropSaveChangesMessagResponse.MessageId;
return newGuid.ToByteArray();
}