mapi

package
v2.0.18+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2017 License: CC0-1.0 Imports: 12 Imported by: 5

Documentation

Index

Constants

View Source
const (
	UseAdminPrivilege       = 0x00000001
	Public                  = 0x00000002
	HomeLogon               = 0x00000004
	TakeOwnership           = 0x00000008
	AlternateServer         = 0x00000100
	IgnoreHomeMDB           = 0x00000200
	NoMail                  = 0x00000400
	UserPerMdbReplidMapping = 0x01000000
	SupportProgress         = 0x20000000
)

OpenFlags

View Source
const (
	PtypInteger16      = 0x0002
	PtypInteger32      = 0x0003
	PtypInteger64      = 0x0014
	PtypFloating32     = 0x0004
	PtypFloating64     = 0x0005
	PtypBoolean        = 0x000B
	PtypString         = 0x001F
	PtypString8        = 0x001E
	PtypGUID           = 0x0048
	PtypRuleAction     = 0x00FE
	PtypRestriction    = 0x00FD
	PtypBinary         = 0x0102
	PtypMultipleBinary = 0x1102
	PtypTime           = 0x0040
)

Property Data types

View Source
const (
	TOP            = 0 //Contains outgoing IPM messages.
	DEFFEREDACTION = 1 //Contains IPM messages that are marked for deletion.
	SPOOLERQ       = 2 //Contains IPM messages that have been sent.
	IPM            = 3 //IPM root folder Contains folders for managing IPM messages.
	INBOX          = 4 //Receive folder Contains incoming messages for a particular message class.
	OUTBOX         = 5 //Search-results root folder Contains folders for managing search results.
	SENT           = 6 //Common-views root folder Contains folders for managing views for the message store.
	DELETED        = 7 //Personal-views root folder
	COMMON         = 8
	SCHEDULE       = 9
	FINDER         = 10
	VIEWS          = 11
	SHORTCUTS      = 12
)

Folder id/locations -- https://msdn.microsoft.com/en-us/library/office/cc815825.aspx ^ this seems to lie

View Source
const (
	MSRemoteDownload = 0x00001000
	MSInConflict     = 0x00000800
	MSRemoteDelete   = 0x00002000
)

Message status flags

View Source
const (
	MAPI_E_INTERFACE_NOT_SUPPORTED     mapicode = 0x80004002
	MAPI_E_CALL_FAILED                 mapicode = 0x80004005
	MAPI_E_NO_ACCESS                   mapicode = 0x80070005
	MAPI_E_NOT_ENOUGH_MEMORY           mapicode = 0x8007000e
	MAPI_E_INVALID_PARAMETER           mapicode = 0x80070057
	MAPI_E_NO_SUPPORT                  mapicode = 0x80040102
	MAPI_E_BAD_CHARWIDTH               mapicode = 0x80040103
	MAPI_E_STRING_TOO_LONG             mapicode = 0x80040105
	MAPI_E_UNKNOWN_FLAGS               mapicode = 0x80040106
	MAPI_E_INVALID_ENTRYID             mapicode = 0x80040107
	MAPI_E_INVALID_OBJECT              mapicode = 0x80040108
	MAPI_E_OBJECT_CHANGED              mapicode = 0x80040109
	MAPI_E_OBJECT_DELETED              mapicode = 0x8004010a
	MAPI_E_BUSY                        mapicode = 0x8004010b
	MAPI_E_NOT_ENOUGH_DISK             mapicode = 0x8004010d
	MAPI_E_NOT_ENOUGH_RESOURCES        mapicode = 0x8004010e
	MAPI_E_NOT_FOUND                   mapicode = 0x8004010f
	MAPI_E_VERSION                     mapicode = 0x80040110
	MAPI_E_LOGON_FAILED                mapicode = 0x80040111
	MAPI_E_SESSION_LIMIT               mapicode = 0x80040112
	MAPI_E_USER_CANCEL                 mapicode = 0x80040113
	MAPI_E_UNABLE_TO_ABORT             mapicode = 0x80040114
	MAPI_E_NETWORK_ERROR               mapicode = 0x80040115
	MAPI_E_DISK_ERROR                  mapicode = 0x80040116
	MAPI_E_TOO_COMPLEX                 mapicode = 0x80040117
	MAPI_E_BAD_COLUMN                  mapicode = 0x80040118
	MAPI_E_EXTENDED_ERROR              mapicode = 0x80040119
	MAPI_E_COMPUTED                    mapicode = 0x8004011a
	MAPI_E_CORRUPT_DATA                mapicode = 0x8004011b
	MAPI_E_UNCONFIGURED                mapicode = 0x8004011c
	MAPI_E_FAILONEPROVIDER             mapicode = 0x8004011d
	MAPI_E_UNKNOWN_CPID                mapicode = 0x8004011e
	MAPI_E_UNKNOWN_LCID                mapicode = 0x8004011f
	MAPI_E_PASSWORD_CHANGE_REQUIRED    mapicode = 0x80040120
	MAPI_E_PASSWORD_EXPIRED            mapicode = 0x80040121
	MAPI_E_INVALID_WORKSTATION_ACCOUNT mapicode = 0x80040122
	MAPI_E_INVALID_ACCESS_TIME         mapicode = 0x80040123
	MAPI_E_ACCOUNT_DISABLED            mapicode = 0x80040124
	MAPI_E_END_OF_SESSION              mapicode = 0x80040200
	MAPI_E_UNKNOWN_ENTRYID             mapicode = 0x80040201
	MAPI_E_MISSING_REQUIRED_COLUMN     mapicode = 0x80040202
	MAPI_W_NO_SERVICE                  mapicode = 0x00040203
	MAPI_E_BAD_VALUE                   mapicode = 0x80040301
	MAPI_E_INVALID_TYPE                mapicode = 0x80040302
	MAPI_E_TYPE_NO_SUPPORT             mapicode = 0x80040303
	MAPI_E_UNEXPECTED_TYPE             mapicode = 0x80040304
	MAPI_E_TOO_BIG                     mapicode = 0x80040305
	MAPI_E_DECLINE_COPY                mapicode = 0x80040306
	MAPI_E_UNEXPECTED_ID               mapicode = 0x80040307
	MAPI_W_ERRORS_RETURNED             mapicode = 0x00040380
	MAPI_E_UNABLE_TO_COMPLETE          mapicode = 0x80040400
	MAPI_E_TIMEOUT                     mapicode = 0x80040401
	MAPI_E_TABLE_EMPTY                 mapicode = 0x80040402
	MAPI_E_TABLE_TOO_BIG               mapicode = 0x80040403
	MAPI_E_INVALID_BOOKMARK            mapicode = 0x80040405
	MAPI_W_POSITION_CHANGED            mapicode = 0x00040481
	MAPI_W_APPROX_COUNT                mapicode = 0x00040482
	MAPI_E_WAIT                        mapicode = 0x80040500
	MAPI_E_CANCEL                      mapicode = 0x80040501
	MAPI_E_NOT_ME                      mapicode = 0x80040502
	MAPI_W_CANCEL_MESSAGE              mapicode = 0x00040580
	MAPI_E_CORRUPT_STORE               mapicode = 0x80040600
	MAPI_E_NOT_IN_QUEUE                mapicode = 0x80040601
	MAPI_E_NO_SUPPRESS                 mapicode = 0x80040602
	MAPI_E_COLLISION                   mapicode = 0x80040604
	MAPI_E_NOT_INITIALIZED             mapicode = 0x80040605
	MAPI_E_NON_STANDARD                mapicode = 0x80040606
	MAPI_E_NO_RECIPIENTS               mapicode = 0x80040607
	MAPI_E_SUBMITTED                   mapicode = 0x80040608
	MAPI_E_HAS_FOLDERS                 mapicode = 0x80040609
	MAPI_E_HAS_MESSAGES                mapicode = 0x8004060a
	MAPI_E_FOLDER_CYCLE                mapicode = 0x8004060b
	MAPI_E_STORE_FULL                  mapicode = 0x8004060c
	MAPI_E_LOCKID_LIMIT                mapicode = 0x8004060D
	MAPI_W_PARTIAL_COMPLETION          mapicode = 0x00040680
	MAPI_E_AMBIGUOUS_RECIP             mapicode = 0x80040700
	SYNC_E_OBJECT_DELETED              mapicode = 0x80040800
	SYNC_E_IGNORE                      mapicode = 0x80040801
	SYNC_E_CONFLICT                    mapicode = 0x80040802
	SYNC_E_NO_PARENT                   mapicode = 0x80040803
	SYNC_E_INCEST                      mapicode = 0x80040804
	SYNC_E_UNSYNCHRONIZED              mapicode = 0x80040805
	SYNC_W_PROGRESS                    mapicode = 0x00040820
	SYNC_W_CLIENT_CHANGE_NEWER         mapicode = 0x00040821
)
View Source
const HTTP int = 1

HTTP transport type for MAPI over HTTP types

View Source
const RPC int = 2

RPC over HTTP transport type for traditional MAPI

Variables

View Source
var (
	//ErrTransport for when errors occurr on the transport layer
	ErrTransport = errors.New("mapi: a transport layer error occurred")
	//ErrMapiNonZero for non-zero return code in a MAPI request
	ErrMapiNonZero = errors.New("mapi: non-zero return value")
	//ErrUnknown hmm, we didn't account for this
	ErrUnknown = errors.New("mapi: an unhandled exception occurred")
	//ErrNotAdmin when attempting to get admin access to a mailbox
	ErrNotAdmin = errors.New("mapi: Invalid logon. Admin privileges requested but user is not admin")
)
View Source
var AuthSession *utils.Session

AuthSession holds all our session related info

View Source
var PidTagAccess = PropertyTag{PtypInteger32, 0x0ff4}

PidTagAccess indicates operations available

View Source
var PidTagAddressBookDisplayNamePrintable = PropertyTag{PtypString, 0x39FF}

PidTagAddressBookDisplayNamePrintable used in recepient

View Source
var PidTagAddressType = PropertyTag{PtypString, 0x3001}

PidTagAddressType display name of the folder

View Source
var PidTagBody = PropertyTag{PtypString, 0x1000}

PidTagBody a

View Source
var PidTagBodyContentID = PropertyTag{PtypString, 0x1015}

PidTagBodyContentID a

View Source
var PidTagBodyHTML = PropertyTag{PtypBinary, 0x1013}

PidTagBodyHTML is the message id of a message in a store

View Source
var PidTagContentCount = PropertyTag{PtypInteger32, 0x3602}

PidTagContentCount specifies the number of rows under the header row

View Source
var PidTagContentUnreadCount = PropertyTag{PtypInteger32, 0x3603}

PidTagContentUnreadCount specifies the number of rows under the header row

View Source
var PidTagConversationTopic = PropertyTag{PtypString, 0x0070}

PidTagConversationTopic a

View Source
var PidTagDefaultPostMessageClass = PropertyTag{PtypString, 0x36e5}

PidTagDefaultPostMessageClass contains message class of the object

View Source
var PidTagDisplayName = PropertyTag{PtypString, 0x3001}

PidTagDisplayName display name of the folder

View Source
var PidTagDisplayType = PropertyTag{PtypInteger32, 0x3900}

PidTagDisplayType used in recepient

View Source
var PidTagDisplayTypeEx = PropertyTag{PtypInteger32, 0x3905}

PidTagDisplayTypeEx used in recepient

View Source
var PidTagEmailAddress = PropertyTag{PtypString, 0x3003}

PidTagEmailAddress display name of the folder

View Source
var PidTagEntryID = PropertyTag{PtypBinary, 0x0FFF}

PidTagEntryID display name of the folder

View Source
var PidTagFolderID = PropertyTag{PtypInteger64, 0x6748}

PidTagFolderID the ID of the folder

View Source
var PidTagFolderType = PropertyTag{PtypInteger32, 0x3601}

PidTagFolderType specifies the type of folder that includes the root folder,

View Source
var PidTagHTMLBody = PropertyTag{PtypString, 0x1013}

PidTagHTMLBody is the same as above?

View Source
var PidTagHidden = PropertyTag{PtypBoolean, 0x10F4}

PidTagHidden specify whether folder is hidden

View Source
var PidTagIconIndex = TaggedPropertyValue{PropertyTag{PtypInteger32, 0x1080}, []byte{0xFF, 0xFF, 0xFF, 0xFF}}

PidTagIconIndex index of the icon to display

View Source
var PidTagInstID = PropertyTag{PtypInteger64, 0x674D}

PidTagInstID identifier for all instances of a row in the table

View Source
var PidTagInstanceNum = PropertyTag{PtypInteger32, 0x674E}

PidTagInstanceNum identifier for single instance of a row in the table

View Source
var PidTagLocaleID = PropertyTag{PtypInteger32, 0x66A1}

PidTagLocaleID contains the Logon object LocaleID

View Source
var PidTagMemberName = PropertyTag{PtypBinary, 0x6672}

PidTagMemberName contains user-readable name of the user

View Source
var PidTagMessageClass = PropertyTag{PtypString, 0x001A}

PidTagMessageClass this will always be IPM.Note

View Source
var PidTagMessageClassIPMNote = TaggedPropertyValue{PropertyTag{PtypString, 0x001A}, utils.UniString("IPM.Note")}

PidTagMessageClassIPMNote this will always be IPM.Note

View Source
var PidTagMessageEditorFormat = TaggedPropertyValue{PropertyTag{PtypInteger32, 0x5909}, []byte{0x01, 0x00, 0x00, 0x00}}

PidTagMessageEditorFormat format lets do plaintext

View Source
var PidTagMessageFlags = PropertyTag{PtypInteger32, 0x0E07} //0x00000008

PidTagMessageFlags setting this to unsent

View Source
var PidTagMessageLocaleID = TaggedPropertyValue{PropertyTag{PtypInteger32, 0x3FF1}, []byte{0x09, 0x04, 0x00, 0x00}}

PidTagMessageLocaleID format lets do en-us

View Source
var PidTagMid = PropertyTag{PtypInteger64, 0x674A}

PidTagMid is the message id of a message in a store

View Source
var PidTagNativeBody = PropertyTag{PtypInteger32, 0x1016}

PidTagNativeBody format of the body

View Source
var PidTagNormalizedSubject = PropertyTag{PtypString, 0x0E1D}

PidTagNormalizedSubject used in recepient

View Source
var PidTagObjectType = PropertyTag{PtypInteger32, 0x0FFE}

PidTagObjectType used in recepient

View Source
var PidTagParentFolderID = PropertyTag{PtypInteger64, 0x6749}

PidTagParentFolderID Contains a value that contains the Folder ID

View Source
var PidTagPrimarySendAccount = PropertyTag{PtypString, 0x0E28}

PidTagPrimarySendAccount who is sending

View Source
var PidTagRecipientDisplayName = PropertyTag{PtypString, 0x5FF6}

PidTagRecipientDisplayName used in recepient

View Source
var PidTagRecipientEntryID = PropertyTag{PtypBinary, 0x5FF7}

PidTagRecipientEntryID used in recepient

View Source
var PidTagRecipientFlags = PropertyTag{PtypInteger32, 0x5FFD}

PidTagRecipientFlags used in recepient

View Source
var PidTagRecipientOrder = PropertyTag{PtypInteger32, 0x5FDF}

PidTagRecipientOrder used in recepient

View Source
var PidTagRecipientTrackStatus = PropertyTag{PtypInteger32, 0x5FFF}

PidTagRecipientTrackStatus used in recepient

View Source
var PidTagRuleActions = PropertyTag{PtypRuleAction, 0x6680}

PidTagRuleActions the TaggedPropertyValue for rule id

View Source
var PidTagRuleCondition = PropertyTag{PtypRestriction, 0x6679}

PidTagRuleCondition the TaggedPropertyValue for rule id

View Source
var PidTagRuleID = PropertyTag{PtypInteger64, 0x6674}

PidTagRuleID the TaggedPropertyValue for rule id

View Source
var PidTagRuleLevel = PropertyTag{PtypInteger32, 0x6683}

PidTagRuleLevel the TaggedPropertyValue for rule level

View Source
var PidTagRuleName = PropertyTag{PtypString, 0x6682}

PidTagRuleName the TaggedPropertyValue for rule id

View Source
var PidTagRuleProvider = PropertyTag{PtypString, 0x6681}

PidTagRuleProvider the TaggedPropertyValue for rule id

View Source
var PidTagRuleProviderData = PropertyTag{PtypBinary, 0x6684}

PidTagRuleProviderData the TaggedPropertyValue for rule id

View Source
var PidTagRuleSequence = PropertyTag{PtypInteger32, 0x6676}

PidTagRuleSequence the TaggedPropertyValue for rule id

View Source
var PidTagRuleState = PropertyTag{PtypInteger32, 0x6677}

PidTagRuleState the TaggedPropertyValue for rule id

View Source
var PidTagRuleUserFlags = PropertyTag{PtypInteger32, 0x6678}

PidTagRuleUserFlags the TaggedPropertyValue for rule user flags

View Source
var PidTagSMTPAddress = PropertyTag{PtypString, 0x39FE}

PidTagSMTPAddress used in recepient

View Source
var PidTagSendInternetEncoding = PropertyTag{PtypInteger32, 0x3a71}

PidTagSendInternetEncoding used in recepient

View Source
var PidTagSentMailSvrEID = PropertyTag{0x00FB, 0x6740}

PidTagSentMailSvrEID id of the sent folder

View Source
var PidTagSubfolders = PropertyTag{PtypBoolean, 0x360a}

PidTagSubfolders specifies whether the folder has subfolders

View Source
var PidTagSubject = PropertyTag{PtypString, 0x0037}

PidTagSubject used in recepient

View Source
var PidTagSubjectPrefix = PropertyTag{PtypString, 0x0003}

PidTagSubjectPrefix used in recepient

View Source
var Unspecifiedproperty = PropertyTag{PtypInteger32, 0x5FDE}

Unspecifiedproperty used in recepient

Functions

func Disconnect

func Disconnect() (int, error)

Disconnect function to be nice and disconnect us from the server This is strictly necessary but hey... lets follow protocol

func ExecuteMailRuleDelete

func ExecuteMailRuleDelete(ruleid []byte) error

ExecuteMailRuleDelete function to delete mailrules

func ExtractMapiAddressBookURL

func ExtractMapiAddressBookURL(resp *utils.AutodiscoverResp) string

ExtractMapiAddressBookURL extract the External mapi url from the autodiscover response

func ExtractMapiURL

func ExtractMapiURL(resp *utils.AutodiscoverResp) string

ExtractMapiURL extract the External mapi url from the autodiscover response

func ExtractRPCURL

func ExtractRPCURL(resp *utils.AutodiscoverResp) string

ExtractRPCURL extract the External RPC url from the autodiscover response

func FastTransferFetchStep

func FastTransferFetchStep(handles []byte) ([]byte, error)

FastTransferFetchStep fetches the next part of a fast TransferBuffer

func GetProps

func GetProps()

GetProps function to get specific properties on an object

func Init

func Init(config *utils.Session, lid, URL, ABKURL string, transport int)

Init is used to start our mapi session

func Ping

func Ping()

Ping send a PING message to the server

func ReadPropertyValue

func ReadPropertyValue(resp []byte, propType uint16) ([]byte, int)

ReadPropertyValue v

Types

type ActionData

type ActionData struct {
	ActionElem []byte
	//NameLen    uint8
	ActionName []byte
	Element    []byte
	//TriggerLen  uint8
	Triggger []byte
	Elem     []byte
	//EndpointLen uint8
	EndPoint []byte
	Footer   []byte
}

ActionData struct

type AddressBookPropertyRow

type AddressBookPropertyRow struct {
	Flags uint8 //if 0x0 -- ValueArray = type(AddressBookPropertyValue)
	//if 0x1 ValueArray = type(AddressBookFlaggedPropertyValueWithType)
	AddressBookPropertyValue []AddressBookPropertyValue
}

AddressBookPropertyRow struct to hold addressbook entries

func (*AddressBookPropertyRow) Unmarshal

func (abpr *AddressBookPropertyRow) Unmarshal(resp []byte, columns LargePropertyTagArray) (int, error)

Unmarshal func

type AddressBookPropertyValue

type AddressBookPropertyValue struct {
	Value []byte
}

AddressBookPropertyValue holds an addressbook value

func (AddressBookPropertyValue) Marshal

func (abpv AddressBookPropertyValue) Marshal() []byte

Marshal turn AddressBookPropertyValue into Bytes

type AddressBookPropertyValueList

type AddressBookPropertyValueList struct {
	PropertyValueCount uint32
	PropertyValues     []AddressBookTaggedPropertyValue
}

AddressBookPropertyValueList used to list addressbook

func (*AddressBookPropertyValueList) Unmarshal

func (abt *AddressBookPropertyValueList) Unmarshal(resp []byte) (int, error)

Unmarshal func

type AddressBookTaggedPropertyValue

type AddressBookTaggedPropertyValue struct {
	PropertyType  uint16
	PropertyID    uint16
	PropertyValue []byte
}

AddressBookTaggedPropertyValue used to hold a value for an Addressbook entry

func (*AddressBookTaggedPropertyValue) Unmarshal

func (abt *AddressBookTaggedPropertyValue) Unmarshal(resp []byte) (int, error)

Unmarshal func for the AddressBookTaggedPropertyValue structure

type BindRequest

type BindRequest struct {
	Flags               uint32
	HasState            byte
	State               []byte //optional 36 bytes
	AuxiliaryBufferSize uint32
	AuxiliaryBuffer     []byte
}

BindRequest struct used in bind request to bind to addressbook

func (BindRequest) Marshal

func (bindRequest BindRequest) Marshal() []byte

Marshal turn BindRequest into Bytes

type BindRequestRPC

type BindRequestRPC struct {
	Flags      uint32
	State      []byte //optional 36 bytes
	ServerGUID []byte
}

func (BindRequestRPC) Marshal

func (bindRequest BindRequestRPC) Marshal() []byte

Marshal turn BindRequestRPC into Bytes

type BindResponse

type BindResponse struct {
	StatusCode          uint32
	ErrorCode           uint32
	ServerGUID          []byte
	AuxiliaryBufferSize uint32
	AuxiliaryBuffer     []byte
}

BindResponse struct

func BindAddressBook

func BindAddressBook() (*BindResponse, error)

BindAddressBook function to bind to the AddressBook provider

func BindAddressBookRPC

func BindAddressBookRPC() (*BindResponse, error)

BindAddressBookRPC function to bind to the AddressBook provider

func (*BindResponse) Unmarshal

func (bindResponse *BindResponse) Unmarshal(resp []byte) (int, error)

Unmarshal func

type ConnectRequest

type ConnectRequest struct {
	UserDN            []byte
	Flags             uint32
	DefaultCodePage   uint32
	LcidString        uint32
	LcidSort          uint32
	AuxilliaryBufSize uint32
	AuxilliaryBuf     []byte
}

ConnectRequest struct

func (ConnectRequest) Marshal

func (connRequest ConnectRequest) Marshal() []byte

Marshal turn ConnectRequest into Bytes

type ConnectRequestRPC

type ConnectRequestRPC struct {
	DNLen               uint32
	Reserved            uint32
	DNLenActual         uint32
	UserDN              []byte
	Flags               uint32
	DNHash              uint32
	CbLimit             uint32 //[]byte
	DefaultCodePage     uint32
	LcidString          uint32
	LcidSort            uint32
	IcxrLink            uint32
	FCanConvertCodePage uint16
	ClientVersion       []byte
	TimeStamp           uint32
	AuxilliaryBufSize   uint32
	AuxilliaryBuf       []byte
}

ConnectRequestRPC ConnectRequest structure for RPC

func (ConnectRequestRPC) Marshal

func (connRequest ConnectRequestRPC) Marshal() []byte

Marshal turn ConnectRequest into Bytes

type ConnectResponse

type ConnectResponse struct {
	StatusCode           uint32 //if 0x00000 --> failure and we only have AuzilliaryBufferSize and AuxilliaryBuffer
	ErrorCode            uint32
	PollsMax             uint32
	RetryCount           uint32
	RetryDelay           uint32
	DNPrefix             []byte
	DisplayName          []byte
	AuxilliaryBufferSize uint32
	AuxilliaryBuffer     []byte
}

ConnectResponse strcut

func (*ConnectResponse) Unmarshal

func (connResponse *ConnectResponse) Unmarshal(resp []byte) error

Unmarshal function to convert response into ConnectResponse struct

type DisconnectRequest

type DisconnectRequest struct {
	AuxilliaryBufSize uint32
	AuxilliaryBuf     []byte
}

DisconnectRequest structure

func (DisconnectRequest) Marshal

func (disconnectRequest DisconnectRequest) Marshal() []byte

Marshal turn DisconnectRequest into Bytes

type DnToMinIDRequest

type DnToMinIDRequest struct {
	Reserved            uint32
	HasNames            byte
	NameCount           uint32
	NameValues          []byte
	AuxiliaryBufferSize uint32
	AuxiliaryBuffer     []byte
}

DnToMinIDRequest struct used to get list of addressbooks

func (DnToMinIDRequest) Marshal

func (dntominid DnToMinIDRequest) Marshal() []byte

Marshal turn DnToMinIDRequest into Bytes

type DnToMinIDResponse

type DnToMinIDResponse struct {
	StatusCode          uint32
	ErrorCode           uint32
	HasMinimalIds       byte
	MinimalIDCount      uint32 //if hasversion is set
	MinimalIds          []byte
	AuxiliaryBufferSize uint32
	AuxiliaryBuffer     []byte
}

DnToMinIDResponse struct

func DnToMinID

func DnToMinID() (*DnToMinIDResponse, error)

DnToMinID function to map DNs to a set of Minimal Entry IDs

func (*DnToMinIDResponse) Unmarshal

func (dnResponse *DnToMinIDResponse) Unmarshal(resp []byte) (int, error)

Unmarshal func

type ErrorCode

type ErrorCode struct {
	ErrorCode uint32
}

ErrorCode returns the mapi error code encountered

func (*ErrorCode) Error

func (e *ErrorCode) Error() string

type ErrorMapiCode

type ErrorMapiCode struct {
	X mapicode
}

ErrorMapiCode provides a mapping of uint32 error code to string

type ExecuteRequest

type ExecuteRequest struct {
	Flags             uint32 //[]byte //lets stick to ropFlagsNoXorMagic
	RopBufferSize     uint32
	RopBuffer         ROPBuffer
	MaxRopOut         uint32
	RPCPtr            []byte
	AuxilliaryBufSize uint32
	AuxilliaryBuf     []byte
}

ExecuteRequest struct

func (*ExecuteRequest) CalcSizes

func (execRequest *ExecuteRequest) CalcSizes(isRPC bool) error

CalcSizes func to calculate the different size fields in the ROP buffer

func (*ExecuteRequest) Init

func (execRequest *ExecuteRequest) Init()

Init function to create a base ExecuteRequest object

func (ExecuteRequest) Marshal

func (execRequest ExecuteRequest) Marshal() []byte

Marshal turn ExecuteRequest into Bytes

func (ExecuteRequest) MarshalRPC

func (execRequest ExecuteRequest) MarshalRPC() []byte

MarshalRPC turn ExecuteRequest into Bytes

type ExecuteRequestRPC

type ExecuteRequestRPC struct {
	Flags         uint32 //[]byte //lets stick to ropFlagsNoXorMagic
	RopBufferSize uint32
	RopBuffer     ROPBuffer
	MaxRopOut     uint32
}

ExecuteRequestRPC struct for RPC ExecuteRequest, slightly different from MAPI/HTTP

func (ExecuteRequestRPC) Marshal

func (execRequest ExecuteRequestRPC) Marshal() []byte

Marshal turn ExecuteRequest into Bytes

type ExecuteResponse

type ExecuteResponse struct {
	StatusCode        uint32 //if 0x00000 --> failure and we only have AuzilliaryBufferSize and AuxilliaryBuffer
	ErrorCode         uint32
	Flags             uint32 //0x00000000 always
	RopBufferSize     uint32
	RopBuffer         []byte //struct{}
	AuxilliaryBufSize uint32
	AuxilliaryBuf     []byte
}

ExecuteResponse struct

func ExecuteMailRuleAdd

func ExecuteMailRuleAdd(rulename, triggerword, triggerlocation string, delete bool) (*ExecuteResponse, error)

ExecuteMailRuleAdd adds a new mailrules

func (*ExecuteResponse) Unmarshal

func (execResponse *ExecuteResponse) Unmarshal(resp []byte) error

Unmarshal for ExecuteResponse the output seems to vary for MAPIHTTP and RPC MAPIHTTP StatusCode,ErrorCode,Flags,RopBufferSize RPC StatusCode,RopBufferSize,Flags,RopBufferSize

type GetSpecialTableRequest

type GetSpecialTableRequest struct {
	Flags               uint32
	HasState            byte
	State               []byte //optional 36 bytes
	HasVersion          byte
	Version             uint32 //optional if HasVersion
	AuxiliaryBufferSize uint32
	AuxiliaryBuffer     []byte
}

GetSpecialTableRequest struct used to get list of addressbooks

func (GetSpecialTableRequest) Marshal

func (specialTableRequest GetSpecialTableRequest) Marshal() []byte

Marshal turn GetSpecialTableRequest into Bytes

type GetSpecialTableResponse

type GetSpecialTableResponse struct {
	StatusCode          uint32
	ErrorCode           uint32
	CodePage            uint32
	HasVersion          byte
	Version             uint32 //if hasversion is set
	HasRows             byte
	RowsCount           uint32 //if HasRows is set
	Rows                []AddressBookPropertyValueList
	AuxiliaryBufferSize uint32
	AuxiliaryBuffer     []byte
}

GetSpecialTableResponse struct

func GetSpecialTable

func GetSpecialTable() (*GetSpecialTableResponse, error)

GetSpecialTable function to get special table from addressbook provider

func (*GetSpecialTableResponse) Unmarshal

func (gstResponse *GetSpecialTableResponse) Unmarshal(resp []byte) (int, error)

Unmarshal func

type LargePropertyTagArray

type LargePropertyTagArray struct {
	PropertyTagCount uint32
	PropertyTags     []PropertyTag
}

LargePropertyTagArray contains a list of propertytags

func (*LargePropertyTagArray) Unmarshal

func (lpta *LargePropertyTagArray) Unmarshal(resp []byte) (int, error)

Unmarshal func

type ModifyRecipientRow

type ModifyRecipientRow struct {
	RowID            uint32
	RecipientType    uint8
	RecipientRowSize uint16
	RecipientRow     RecipientRow
}

ModifyRecipientRow contains information about a recipient

type PropertyRow

type PropertyRow struct {
	Flag       uint8 //non-zero indicates error
	ValueArray []byte
}

PropertyRow used to hold the data of getRow requests such as RopGetPropertiesSpecific

func DecodeBufferToRows

func DecodeBufferToRows(buff []byte, cols []PropertyTag) []PropertyRow

DecodeBufferToRows returns the property rows contained in the buffer, takes a list of propertytags. These are needed to figure out how to split the columns in the rows

type PropertyTag

type PropertyTag struct {
	PropertyType uint16
	PropertyID   uint16 //[]byte //uint16
}

PropertyTag struct

func (*PropertyTag) Unmarshal

func (propTag *PropertyTag) Unmarshal(resp []byte) (int, error)

Unmarshal func

type QueryRowsRequest

type QueryRowsRequest struct {
	Flags               uint32
	HasState            byte
	State               []byte //36 bytes if hasstate
	ExplicitTableCount  uint32
	ExplicitTable       []byte //array of MinimalEntryID
	RowCount            uint32
	HasColumns          byte
	Columns             LargePropertyTagArray //array of LargePropertyTagArray if hascolumns is set
	AuxiliaryBufferSize uint32
	AuxiliaryBuffer     []byte
}

QueryRowsRequest struct used to get list of addressbooks

func (QueryRowsRequest) Marshal

func (qrows QueryRowsRequest) Marshal() []byte

Marshal turn QueryRowsRequest into Bytes

type QueryRowsResponse

type QueryRowsResponse struct {
	StatusCode          uint32
	ErrorCode           uint32
	HasState            byte
	State               []byte //36 bytes if hasState enabled
	HasColsAndRows      byte
	Columns             LargePropertyTagArray //array of LargePropertyTagArray //set if HasColsAndRows is set
	RowCount            uint32                //if HasColsAndRows is non-zero
	RowData             []AddressBookPropertyRow
	AuxiliaryBufferSize uint32
	AuxiliaryBuffer     []byte
}

QueryRowsResponse struct

func QueryRows

func QueryRows(rowCount int, state []byte, columns []PropertyTag) (*QueryRowsResponse, error)

QueryRows function gets number of rows from the specified explicit table

func SeekEntries

func SeekEntries(entryStart []byte, columns []PropertyTag) (*QueryRowsResponse, error)

SeekEntries function moves the pointer to a new position in the addressbook

func (*QueryRowsResponse) Unmarshal

func (qrResponse *QueryRowsResponse) Unmarshal(resp []byte) (int, error)

Unmarshal func

type ROP

type ROP struct {
	RopSize                 uint16
	RopsList                []byte
	ServerObjectHandleTable []byte
}

ROP request

type ROPBuffer

type ROPBuffer struct {
	Header RPCHeader
	ROP    ROP
}

ROPBuffer struct

type RPCHeader

type RPCHeader struct {
	Version    uint16 //always 0x0000
	Flags      uint16 //0x0001 Compressed, 0x0002 XorMagic, 0x0004 Last
	Size       uint16
	SizeActual uint16 //Compressed size (if 0x0001 set)
}

RPCHeader struct

type RecipientRow

type RecipientRow struct {
	RecipientFlags uint16
	//AddressPrefixUsed    uint8
	//DisplayType          uint8
	EmailAddress         []byte
	DisplayName          []byte
	SimpleDisplayName    []byte
	RecipientColumnCount uint16
	RecipientProperties  StandardPropertyRow
}

RecipientRow holds a recipient of a mail message

type Request

type Request interface {
	Marshal() []byte
}

Request interface type

type RgbAuxIn

type RgbAuxIn struct {
	RPCHeader RPCHeader
}

RgbAuxIn struct

type RopBuffer

type RopBuffer interface {
	Unmarshal([]byte) error
}

RopBuffer interface for common methods on RopBuffer Data

type RopCreateAttachmentRequest

type RopCreateAttachmentRequest struct {
	RopID        uint8 //0x23
	LogonID      uint8
	InputHandle  uint8
	OutputHandle uint8
}

RopCreateAttachmentRequest used to create an attachment

type RopCreateAttachmentResponse

type RopCreateAttachmentResponse struct {
	RopID        uint8 //0x23
	OutputHandle uint8
	ReturnValue  uint32
	AttachmentID []byte
}

RopCreateAttachmentResponse holds the response to a create attachment

type RopCreateFolderRequest

type RopCreateFolderRequest struct {
	RopID             uint8 //0x1C
	LogonID           uint8
	InputHandle       uint8
	OutputHandle      uint8
	FolderType        uint8
	UseUnicodeStrings uint8
	OpenExisting      uint8
	Reserved          uint8
	DisplayName       []byte
	Comment           []byte
}

RopCreateFolderRequest struct used to create a folder

func (RopCreateFolderRequest) Marshal

func (createFolder RopCreateFolderRequest) Marshal() []byte

Marshal turn RopCreateFolderRequest into Bytes

type RopCreateFolderResponse

type RopCreateFolderResponse struct {
	RopID            uint8 //0x1C
	OutputHandle     uint8
	ReturnValue      uint32
	FolderID         []byte
	IsExisting       uint8
	HasRules         byte   //bool
	IsGhosted        byte   //bool
	ServerCount      uint16 //only if IsGhosted == true
	CheapServerCount uint16 //only if IsGhosted == true
	Servers          []byte //only if IsGhosted == true
}

RopCreateFolderResponse struct used to create a folder

func CreateFolder

func CreateFolder(folderName string, hidden bool) (*RopCreateFolderResponse, error)

CreateFolder function to create a folder on the exchange server

func (*RopCreateFolderResponse) Unmarshal

func (createFolder *RopCreateFolderResponse) Unmarshal(resp []byte) (int, error)

Unmarshal func for RopCreateFolderResponse

type RopCreateMessageRequest

type RopCreateMessageRequest struct {
	RopID          uint8 //0x32
	LogonID        uint8
	InputHandle    uint8
	OutputHandle   uint8
	CodePageID     uint16
	FolderID       []byte
	AssociatedFlag byte //bool
}

RopCreateMessageRequest struct used to open handle to new email message

func (RopCreateMessageRequest) Marshal

func (createMessage RopCreateMessageRequest) Marshal() []byte

Marshal turn ExecuteRequest into Bytes

type RopCreateMessageResponse

type RopCreateMessageResponse struct {
	RopID        uint8
	OutputHandle uint8
	ReturnValue  uint32
	HasMessageID byte   //bool
	MessageID    []byte //bool
}

RopCreateMessageResponse struct used to open handle to new email message

func (*RopCreateMessageResponse) Unmarshal

func (createMessageResponse *RopCreateMessageResponse) Unmarshal(resp []byte) (int, error)

Unmarshal function to produce RopCreateMessageResponse struct

type RopDeleteFolderRequest

type RopDeleteFolderRequest struct {
	RopID             uint8 //0x1D
	LogonID           uint8
	InputHandle       uint8
	DeleteFolderFlags uint8
	FolderID          []byte
}

RopDeleteFolderRequest used to delete a folder

func (RopDeleteFolderRequest) Marshal

func (deleteFolder RopDeleteFolderRequest) Marshal() []byte

Marshal turn RopDeleteFolderRequest into Bytes

type RopDeleteFolderResponse

type RopDeleteFolderResponse struct {
	RopID           uint8 //0x1D
	InputHandle     uint8
	ReturnValue     uint32
	PartialComplete uint8
}

RopDeleteFolderResponse to delete a folder

func DeleteFolder

func DeleteFolder(folderid []byte) (*RopDeleteFolderResponse, error)

DeleteFolder is used to delete a folder

func (*RopDeleteFolderResponse) Unmarshal

func (deleteFolderResponse *RopDeleteFolderResponse) Unmarshal(resp []byte) (int, error)

Unmarshal function to produce RopDeleteFolderResponse struct

type RopDeleteMessagesRequest

type RopDeleteMessagesRequest struct {
	RopID           uint8 //0x1E
	LogonID         uint8
	InputHandle     uint8
	WantSynchronous uint8
	NotifyNonRead   uint8
	MessageIDCount  uint16
	MessageIDs      []byte //messageIdCount * 64 bit identifiers
}

RopDeleteMessagesRequest struct used to delete one or more messages

func (RopDeleteMessagesRequest) Marshal

func (deleteMessage RopDeleteMessagesRequest) Marshal() []byte

Marshal turn ExecuteRequest into Bytes

type RopDeleteMessagesResponse

type RopDeleteMessagesResponse struct {
	RopID             uint8
	InputHandle       uint8
	ReturnValue       uint32
	PartialCompletion uint8
}

RopDeleteMessagesResponse struct holds response for deleting messages

func DeleteMessages

func DeleteMessages(folderid []byte, messageIDCount int, messageIDs []byte) (*RopDeleteMessagesResponse, error)

DeleteMessages is used to delete a message on the exchange server

func (*RopDeleteMessagesResponse) Unmarshal

func (deleteMessageResponse *RopDeleteMessagesResponse) Unmarshal(resp []byte) (int, error)

Unmarshal function to produce RopDeleteMessagesResponse struct

type RopDisconnectRequest

type RopDisconnectRequest struct {
	RopID            uint8 //0x01
	LogonID          uint8 //logonID to use
	InputHandleIndex uint8
}

RopDisconnectRequest struct

type RopEmptyFolderRequest

type RopEmptyFolderRequest struct {
	RopID                uint8 //0x58
	LogonID              uint8
	InputHandle          uint8
	WantAsynchronous     uint8
	WantDeleteAssociated uint8
}

RopEmptyFolderRequest used to delete all messages and subfolders from a folder

func (RopEmptyFolderRequest) Marshal

func (emptyFolder RopEmptyFolderRequest) Marshal() []byte

Marshal turn RopFastTransferSourceCopyPropertiesRequest into Bytes

type RopEmptyFolderResponse

type RopEmptyFolderResponse struct {
	RopID           uint8 //0x58
	InputHandle     uint8
	ReturnValue     uint32
	PartialComplete uint8
}

RopEmptyFolderResponse to emptying a folder

func EmptyFolder

func EmptyFolder(folderid []byte) (*RopEmptyFolderResponse, error)

EmptyFolder is used to delete all contents of a folder

func (*RopEmptyFolderResponse) Unmarshal

func (emptyFolderResponse *RopEmptyFolderResponse) Unmarshal(resp []byte) (int, error)

Unmarshal function to produce RopEmptyFolderResponse struct

type RopFastTransferDestinationConfigureRequest

type RopFastTransferDestinationConfigureRequest struct {
	RopID           uint8 //0x53
	LogonID         uint8
	InputHandle     uint8
	OutputHandle    uint8
	SourceOperation uint8
	CopyFlags       uint8
}

RopFastTransferDestinationConfigureRequest used to configure a destination buffer for fast TransferBuffer

func (RopFastTransferDestinationConfigureRequest) Marshal

Marshal turn RopFastTransferDestinationConfigureRequest into Bytes

type RopFastTransferDestinationConfigureResponse

type RopFastTransferDestinationConfigureResponse struct {
	RopID        uint8 //0x53
	OutputHandle uint8
	ReturnValue  uint32
}

RopFastTransferDestinationConfigureResponse used to configure a destination buffer for fast TransferBuffer

type RopFastTransferDestinationPutBufferRequest

type RopFastTransferDestinationPutBufferRequest struct {
	RopID            uint8 //0x53
	LogonID          uint8
	InputHandle      uint8
	TransferDataSize uint16
	TransferData     []byte
}

RopFastTransferDestinationPutBufferRequest to actually upload the data

func (RopFastTransferDestinationPutBufferRequest) Marshal

Marshal turn RopFastTransferDestinationConfigureRequest into Bytes

type RopFastTransferSourceCopyPropertiesRequest

type RopFastTransferSourceCopyPropertiesRequest struct {
	RopID            uint8 //0x69
	LogonID          uint8
	InputHandle      uint8
	OutputHandle     uint8
	Level            uint8
	CopyFlags        uint8
	SendOptions      uint8
	PropertyTagCount uint16
	PropertyTags     []PropertyTag
}

RopFastTransferSourceCopyPropertiesRequest struct used to open handle to message

func (RopFastTransferSourceCopyPropertiesRequest) Marshal

func (getProps RopFastTransferSourceCopyPropertiesRequest) Marshal() []byte

Marshal turn RopFastTransferSourceCopyPropertiesRequest into Bytes

type RopFastTransferSourceCopyPropertiesResponse

type RopFastTransferSourceCopyPropertiesResponse struct {
	RopID       uint8 //0x4E
	InputHandle uint8
	ReturnValue uint32
}

RopFastTransferSourceCopyPropertiesResponse struct used to open handle to message

func (*RopFastTransferSourceCopyPropertiesResponse) Unmarshal

func (getPropertiesResponse *RopFastTransferSourceCopyPropertiesResponse) Unmarshal(resp []byte) (int, error)

Unmarshal function to produce RopCreateMessageResponse struct

type RopFastTransferSourceCopyToRequest

type RopFastTransferSourceCopyToRequest struct {
	RopID            uint8 //0x4D
	LogonID          uint8
	InputHandle      uint8
	OutputHandle     uint8
	Level            uint8
	CopyFlags        uint32
	SendOptions      uint8
	PropertyTagCount uint16
	PropertyTags     []PropertyTag
}

RopFastTransferSourceCopyToRequest struct used to open handle to message

func (RopFastTransferSourceCopyToRequest) Marshal

func (getProps RopFastTransferSourceCopyToRequest) Marshal() []byte

Marshal turn RopFastTransferSourceCopyToRequest into Bytes

type RopFastTransferSourceGetBufferRequest

type RopFastTransferSourceGetBufferRequest struct {
	RopID             uint8 //0x4E
	LogonID           uint8
	InputHandle       uint8
	BufferSize        uint16
	MaximumBufferSize uint16 //0xBABE
}

RopFastTransferSourceGetBufferRequest struct used to open handle to message

func (RopFastTransferSourceGetBufferRequest) Marshal

func (getBuff RopFastTransferSourceGetBufferRequest) Marshal() []byte

Marshal turn RopFastTransferSourceGetBufferRequest into Bytes

type RopFastTransferSourceGetBufferResponse

type RopFastTransferSourceGetBufferResponse struct {
	RopID                   uint8 //0x4E
	InputHandle             uint8
	ReturnValue             uint32
	TransferStatus          uint16
	InProgressCount         uint16
	TotalStepCount          uint16
	Reserved                uint8 //0x00
	TotalTransferBufferSize uint16
	TransferBuffer          []byte
	BackoffTime             uint32
}

RopFastTransferSourceGetBufferResponse struct used to open handle to message

func GetMessageFast

func GetMessageFast(folderid, messageid []byte, columns []PropertyTag) (*RopFastTransferSourceGetBufferResponse, error)

GetMessageFast returns the specific fields from a message using the fast transfer buffers. This works better for large messages

func (*RopFastTransferSourceGetBufferResponse) Unmarshal

func (buffResponse *RopFastTransferSourceGetBufferResponse) Unmarshal(resp []byte) (int, error)

Unmarshal function to produce RopFastTransferSourceGetBufferResponse struct

type RopGetContentsTableRequest

type RopGetContentsTableRequest struct {
	RopID             uint8 //0x05
	LogonID           uint8
	InputHandleIndex  uint8
	OutputHandleIndex uint8
	TableFlags        uint8
}

RopGetContentsTableRequest struct

func (RopGetContentsTableRequest) Marshal

func (getContentsTable RopGetContentsTableRequest) Marshal() []byte

Marshal turn RopGetContentsTableRequest into Bytes

type RopGetContentsTableResponse

type RopGetContentsTableResponse struct {
	RopID        uint8 //0x05
	OutputHandle uint8
	ReturnValue  uint32
	RowCount     uint32
}

RopGetContentsTableResponse struct

func GetContentsTable

func GetContentsTable(folderid []byte) (*RopGetContentsTableResponse, []byte, error)

GetContentsTable function get's a folder from the folders id and returns a hanlde to the contents table for that folder

func (*RopGetContentsTableResponse) Unmarshal

func (ropContents *RopGetContentsTableResponse) Unmarshal(resp []byte) (int, error)

Unmarshal func

type RopGetHierarchyTableRequest

type RopGetHierarchyTableRequest struct {
	RopID        uint8 //0x04
	LogonID      uint8
	InputHandle  uint8
	OutputHandle uint8
	TableFlags   uint8
}

RopGetHierarchyTableRequest struct used to get folder hierarchy

func (RopGetHierarchyTableRequest) Marshal

func (getHierarchy RopGetHierarchyTableRequest) Marshal() []byte

Marshal turn RopGetHierarchyTableRequest into Bytes

type RopGetHierarchyTableResponse

type RopGetHierarchyTableResponse struct {
	RopID        uint8 //0x04
	OutputHandle uint8
	ReturnValue  uint32
	RowCount     uint32
}

RopGetHierarchyTableResponse struct used to get folder hierarchy

func GetFolderHierarchy

func GetFolderHierarchy(folderid []byte) (*RopGetHierarchyTableResponse, []byte, error)

GetFolderHierarchy function get's a folder from the folders id and returns a handle to the hierarchy table

func (*RopGetHierarchyTableResponse) Unmarshal

func (ropGetHierarchyResponse *RopGetHierarchyTableResponse) Unmarshal(resp []byte) (int, error)

Unmarshal func

type RopGetPropertiesSpecific

type RopGetPropertiesSpecific struct {
	RopID             uint8 //0x07
	LogonID           uint8
	InputHandle       uint8
	PropertySizeLimit uint16
	WantUnicode       []byte //apparently bool
	PropertyTagCount  uint16
	PropertyTags      []PropertyTag //[]byte
}

RopGetPropertiesSpecific struct to get propertiesfor a folder

func (RopGetPropertiesSpecific) Marshal

func (getProps RopGetPropertiesSpecific) Marshal() []byte

Marshal turn RopGetPropertiesSpecific into Bytes

type RopGetPropertiesSpecificResponse

type RopGetPropertiesSpecificResponse struct {
	RopID             uint8 //0x07
	InputHandleIndex  uint8
	ReturnValue       uint32
	PropertySizeLimit uint16
	RowData           []PropertyRow
}

RopGetPropertiesSpecificResponse struct to get propertiesfor a folder

func DecodeGetTableResponse

func DecodeGetTableResponse(resp []byte, columns []PropertyTag) (*RopGetPropertiesSpecificResponse, error)

DecodeGetTableResponse function Unmarshals the various parts of a getproperties response (this includes the initial openfolder request) and returns the RopGetPropertiesSpecificResponse object to us, we can then cycle through the rows to view the values needs the list of columns that were supplied in the initial request.

func GetMessage

func GetMessage(folderid, messageid []byte, columns []PropertyTag) (*RopGetPropertiesSpecificResponse, error)

GetMessage returns the specific fields from a message

func (*RopGetPropertiesSpecificResponse) Unmarshal

func (ropGetPropertiesSpecificResponse *RopGetPropertiesSpecificResponse) Unmarshal(resp []byte, columns []PropertyTag) (int, error)

Unmarshal func

type RopGetRulesTableRequest

type RopGetRulesTableRequest struct {
	RopID             uint8 //0x3f
	LogonID           uint8
	InputHandleIndex  uint8
	OutputHandleIndex uint8
	TableFlags        byte
}

RopGetRulesTableRequest struct

func (RopGetRulesTableRequest) Marshal

func (getRules RopGetRulesTableRequest) Marshal() []byte

Marshal turn RopGetRulesTableRequest into Bytes

type RopGetRulesTableResponse

type RopGetRulesTableResponse struct {
	RopID        uint8
	OutputHandle uint8
	ReturnValue  uint32
}

RopGetRulesTableResponse strcut

func (*RopGetRulesTableResponse) Unmarshal

func (getRulesTable *RopGetRulesTableResponse) Unmarshal(resp []byte) (int, error)

Unmarshal function to produce RopLogonResponse struct

type RopLogonRequest

type RopLogonRequest struct {
	RopID             uint8 //0xfe
	LogonID           uint8 //logonID to use
	OutputHandleIndex uint8
	LogonFlags        byte
	OpenFlags         uint32 //[]byte
	StoreState        uint32 //0x00000000
	EssdnSize         uint16
	Essdn             []byte
}

RopLogonRequest struct

func (RopLogonRequest) Marshal

func (logonRequest RopLogonRequest) Marshal() []byte

Marshal turn RopLogonRequest into Bytes

type RopLogonResponse

type RopLogonResponse struct {
	RopID             uint8
	OutputHandleIndex uint8
	ReturnValue       uint32
	LogonFlags        byte
	FolderIds         []byte
	ResponseFlags     byte
	MailboxGUID       []byte
	RepID             []byte
	ReplGUID          []byte
	LogonTime         []byte
	GwartTime         []byte
	StoreState        []byte
}

RopLogonResponse struct

func Authenticate

func Authenticate() (*RopLogonResponse, error)

Authenticate is used to create the MAPI session, get's session cookie ect

func AuthenticateFetchMailbox

func AuthenticateFetchMailbox(essdn []byte) (*RopLogonResponse, error)

AuthenticateFetchMailbox func to perform step two of the authentication process

func AuthenticateHTTP

func AuthenticateHTTP() (*RopLogonResponse, error)

AuthenticateHTTP does the authenctication, seems like RPC/HTTP and MAPI/HTTP has slightly different auths

func AuthenticateRPC

func AuthenticateRPC() (*RopLogonResponse, error)

AuthenticateRPC does RPC version of authenticate

func (*RopLogonResponse) Unmarshal

func (logonResponse *RopLogonResponse) Unmarshal(resp []byte) error

Unmarshal function to produce RopLogonResponse struct

type RopModifyRecipientsRequest

type RopModifyRecipientsRequest struct {
	RopID            uint8 //0x0E
	LogonID          uint8
	InputHandle      uint8
	ColumnCount      uint16
	RecipientColumns []PropertyTag
	RowCount         uint16
	RecipientRows    []ModifyRecipientRow
}

RopModifyRecipientsRequest to modify who is receiving email

func (RopModifyRecipientsRequest) Marshal

func (modRecipients RopModifyRecipientsRequest) Marshal() []byte

Marshal turn RopModifyRecipientsRequest into Bytes

type RopModifyRecipientsResponse

type RopModifyRecipientsResponse struct {
	RopID       uint8 //0x0E
	InputHandle uint8
	ReturnValue uint32
}

RopModifyRecipientsResponse to modify who is receiving email

func (*RopModifyRecipientsResponse) Unmarshal

func (modRecipientsResponse *RopModifyRecipientsResponse) Unmarshal(resp []byte) (int, error)

Unmarshal function to produce RopCreateMessageResponse struct

type RopModifyRulesRequest

type RopModifyRulesRequest struct {
	RopID            uint8 //0x41
	LoginID          uint8
	InputHandleIndex uint8
	ModifyRulesFlag  byte
	RulesCount       uint16
	RuleData         RuleData
}

RopModifyRulesRequest struct

type RopModifyRulesRequestBuffer

type RopModifyRulesRequestBuffer struct {
	RopID            uint8 //0x02
	LogonID          uint8
	InputHandleIndex uint8
	ModifyRulesFlag  byte
	RulesCount       uint16
	RulesData        []byte
}

RopModifyRulesRequestBuffer struct

type RopOpenFolderRequest

type RopOpenFolderRequest struct {
	RopID         uint8 //0x02
	LogonID       uint8
	InputHandle   uint8
	OutputHandle  uint8
	FolderID      []byte
	OpenModeFlags uint8
}

RopOpenFolderRequest struct used to open a folder

func (RopOpenFolderRequest) Marshal

func (openFolder RopOpenFolderRequest) Marshal() []byte

Marshal turn RopOpenFolder into Bytes

type RopOpenFolderResponse

type RopOpenFolderResponse struct {
	RopID            uint8
	OutputHandle     uint8
	ReturnValue      uint32
	HasRules         byte   //bool
	IsGhosted        byte   //bool
	ServerCount      uint16 //only if IsGhosted == true
	CheapServerCount uint16 //only if IsGhosted == true
	Servers          []byte //only if IsGhosted == true
}

RopOpenFolderResponse struct used to open a folder

func GetFolder

func GetFolder(folderid int, columns []PropertyTag) (*RopOpenFolderResponse, error)

GetFolder function get's a folder from the folders id FolderIds can be any of the "specialFolders" as defined in Exchange mapi/datastructs.go folder id/locations constants

func (*RopOpenFolderResponse) Unmarshal

func (ropOpenFolderResponse *RopOpenFolderResponse) Unmarshal(resp []byte) (int, error)

Unmarshal func

type RopOpenMessageRequest

type RopOpenMessageRequest struct {
	RopID         uint8 //0x03
	LogonID       uint8
	InputHandle   uint8
	OutputHandle  uint8
	CodePageID    uint16
	FolderID      []byte
	OpenModeFlags byte
	MessageID     []byte
}

RopOpenMessageRequest struct used to open handle to message

func (RopOpenMessageRequest) Marshal

func (openMessage RopOpenMessageRequest) Marshal() []byte

Marshal turn RopOpenMessageRequest into Bytes

type RopOpenMessageResponse

type RopOpenMessageResponse struct {
	RopID              uint8 //0x03
	OutputHandle       uint8
	ReturnValue        uint32
	HasNamedProperties byte
	SubjectPrefix      []byte
	NormalizedSubject  []byte
	RecipientCount     uint16
	ColumnCount        uint16
	RecipientColumns   []PropertyTag
	RowCount           uint8
	RecipientRows      []RecipientRow
}

RopOpenMessageResponse struct used to open handle to message

func (*RopOpenMessageResponse) Unmarshal

func (ropOpenMessageResponse *RopOpenMessageResponse) Unmarshal(resp []byte) (int, error)

Unmarshal func

type RopOpenStreamRequest

type RopOpenStreamRequest struct {
	RopID         uint8 //0x2B
	LogonID       uint8
	InputHandle   uint8
	OutputHandle  uint8
	PropertyTag   []byte
	OpenModeFlags byte
}

RopOpenStreamRequest struct used to open a stream

func (RopOpenStreamRequest) Marshal

func (openStream RopOpenStreamRequest) Marshal() []byte

Marshal turn RopOpenStreamRequest into Bytes

type RopOpenStreamResponse

type RopOpenStreamResponse struct {
	RopID        uint8 //0x2B
	OutputHandle uint8
	ReturnValue  uint32
	StreamSize   uint32
}

RopOpenStreamResponse struct used to open a stream

type RopQueryRowsRequest

type RopQueryRowsRequest struct {
	RopID          uint8 //0x15
	LogonID        uint8
	InputHandle    uint8
	QueryRowsFlags uint8
	ForwardRead    byte
	RowCount       uint16
}

RopQueryRowsRequest struct used to select the columns to use

func (RopQueryRowsRequest) Marshal

func (queryRows RopQueryRowsRequest) Marshal() []byte

Marshal turn the RopQueryRowsRequest into bytes

type RopQueryRowsResponse

type RopQueryRowsResponse struct {
	RopID       uint8 //0x15
	InputHandle uint8
	ReturnValue uint32
	Origin      byte
	RowCount    uint16
	RowData     [][]PropertyRow
}

RopQueryRowsResponse struct used to select the columns to use

func GetContents

func GetContents(folderid []byte) (*RopQueryRowsResponse, error)

GetContents returns the rows of a folder's content table

func GetSubFolders

func GetSubFolders(folderid []byte) (*RopQueryRowsResponse, error)

GetSubFolders returns all the subfolders available in a folder

func (*RopQueryRowsResponse) Unmarshal

func (queryRows *RopQueryRowsResponse) Unmarshal(resp []byte, properties []PropertyTag) (int, error)

Unmarshal func

type RopReadStreamRequest

type RopReadStreamRequest struct {
	RopID            uint8 //0x2C
	LogonID          uint8
	InputHandle      uint8
	ByteCount        uint16
	MaximumByteCount uint32
}

RopReadStreamRequest struct used to open a stream

func (RopReadStreamRequest) Marshal

func (readStream RopReadStreamRequest) Marshal() []byte

Marshal turn RopReadStreamRequest into Bytes

type RopReleaseRequest

type RopReleaseRequest struct {
	RopID       uint8 //0x01
	LogonID     uint8
	InputHandle uint8
}

RopReleaseRequest struct used to release all resources associated with a server object

func (RopReleaseRequest) Marshal

func (releaseRequest RopReleaseRequest) Marshal() []byte

Marshal turn RopReleaseRequest into Bytes

type RopReleaseResponse

type RopReleaseResponse struct {
	RopID       uint8 //0x01
	ReturnValue uint32
}

RopReleaseResponse struct used to release all resources associated with a server object

func ReleaseObject

func ReleaseObject(inputHandle byte) (*RopReleaseResponse, error)

ReleaseObject issues a RopReleaseRequest to free a server handle to an object

func (*RopReleaseResponse) Unmarshal

func (ropRelease *RopReleaseResponse) Unmarshal(resp []byte) (int, error)

Unmarshal func

type RopRequest

type RopRequest interface {
	Marshal(DataStruct interface{}) []byte
}

RopRequest interface for common methods on RopRequests

type RopResponse

type RopResponse interface {
	Unmarshal([]byte) error
}

RopResponse interface for common methods on RopResponses

type RopRestrictRequest

type RopRestrictRequest struct {
	RopID            uint8 //0x14
	LogonID          uint8
	InputHandle      uint8
	RestrictFlags    uint8
	RestrictDataSize uint16
	RestrictionData  []byte
}

RopRestrictRequest strcut

type RopSaveChangesAttachmentRequest

type RopSaveChangesAttachmentRequest struct {
	RopID        uint8 //0x25
	LogonID      uint8
	InputHandle  uint8
	OutputHandle uint8
	SaveFlags    uint8
}

RopSaveChangesAttachmentRequest used to create an attachment

type RopSaveChangesAttachmentResponse

type RopSaveChangesAttachmentResponse struct {
	RopID        uint8 //0x23
	OutputHandle uint8
	ReturnValue  uint32
}

RopSaveChangesAttachmentResponse holds the response to a create attachment

type RopSaveChangesMessageRequest

type RopSaveChangesMessageRequest struct {
	RopID               uint8
	LogonID             uint8
	ResponseHandleIndex uint8
	InputHandle         uint8
	SaveFlags           byte
}

RopSaveChangesMessageRequest struct used to open handle to new email message

func (RopSaveChangesMessageRequest) Marshal

func (saveMessage RopSaveChangesMessageRequest) Marshal() []byte

Marshal turn RopSaveChangesMessageRequest into Bytes

type RopSaveChangesMessageResponse

type RopSaveChangesMessageResponse struct {
	RopID               uint8
	ResponseHandleIndex uint8
	ReturnValue         uint32
	InputHandle         uint8
	MessageID           []byte
}

RopSaveChangesMessageResponse struct used to open handle to new email message

func CreateMessage

func CreateMessage(folderID []byte, properties []TaggedPropertyValue) (*RopSaveChangesMessageResponse, error)

CreateMessage is used to create a message on the exchange server

func SaveMessageFast

func SaveMessageFast(inputHandle, responseHandle byte, serverHandles []byte) (*RopSaveChangesMessageResponse, error)

SaveMessageFast uses the RopFastTransfer buffers to save a message

func SetPropertyFast

func SetPropertyFast(folderid []byte, messageid []byte, property TaggedPropertyValue) (*RopSaveChangesMessageResponse, error)

SetPropertyFast is used to create a message on the exchange server through a the RopFastTransferSourceGetBufferRequest

func (*RopSaveChangesMessageResponse) Unmarshal

func (saveMessageResponse *RopSaveChangesMessageResponse) Unmarshal(resp []byte) error

Unmarshal function to produce RopSaveChangesMessageResponse struct

type RopSetColumnsRequest

type RopSetColumnsRequest struct {
	RopID            uint8 //0x12
	LogonID          uint8
	InputHandle      uint8
	SetColumnFlags   uint8
	PropertyTagCount uint16
	PropertyTags     []PropertyTag
}

RopSetColumnsRequest struct used to select the columns to use

func (RopSetColumnsRequest) Marshal

func (setColumns RopSetColumnsRequest) Marshal() []byte

Marshal to turn the RopSetColumnsRequest into bytes

type RopSetColumnsResponse

type RopSetColumnsResponse struct {
	RopID       uint8 //0x12
	InputHandle uint8
	ReturnValue uint32
	TableStatus uint8
}

RopSetColumnsResponse struct used to select the columns to use

func (*RopSetColumnsResponse) Unmarshal

func (setColumnsResponse *RopSetColumnsResponse) Unmarshal(resp []byte) (int, error)

Unmarshal func

type RopSetMessageStatusRequest

type RopSetMessageStatusRequest struct {
	RopID              uint8 //0x20
	LogonID            uint8
	InputHandle        uint8
	MessageID          []byte
	MessageStatusFlags PropertyTag
	MessageStatusMask  uint32
}

RopSetMessageStatusRequest struct used to select the columns to use

func (RopSetMessageStatusRequest) Marshal

func (setStatus RopSetMessageStatusRequest) Marshal() []byte

Marshal turn RopSetMessageStatusRequest into Bytes

type RopSetMessageStatusResponse

type RopSetMessageStatusResponse struct {
	RopID              uint8 //0x20
	InputHandle        uint8
	ReturnValue        uint32
	MessageStatusFlags uint32
}

RopSetMessageStatusResponse struct used to select the columns to use

func SetMessageStatus

func SetMessageStatus(folderid, messageid []byte) (*RopSetMessageStatusResponse, error)

SetMessageStatus is used to create a message on the exchange server

func (*RopSetMessageStatusResponse) Unmarshal

func (setStatus *RopSetMessageStatusResponse) Unmarshal(resp []byte) (int, error)

Unmarshal func

type RopSetPropertiesRequest

type RopSetPropertiesRequest struct {
	RopID             uint8 //0x0A
	LogonID           uint8
	InputHandle       uint8
	PropertValueSize  uint16
	PropertValueCount uint16
	PropertyValues    []TaggedPropertyValue
}

RopSetPropertiesRequest struct to set properties on an object

func (RopSetPropertiesRequest) Marshal

func (setProperties RopSetPropertiesRequest) Marshal() []byte

Marshal turn RopSetPropertiesRequest into Bytes

type RopSetPropertiesResponse

type RopSetPropertiesResponse struct {
	RopID                uint8 //0x0A
	InputHandle          uint8
	ReturnValue          uint32
	PropertyProblemCount uint16
	PropertyProblems     []byte
}

RopSetPropertiesResponse struct to set properties on an object

func (*RopSetPropertiesResponse) Unmarshal

func (setPropertiesResponse *RopSetPropertiesResponse) Unmarshal(resp []byte) (int, error)

Unmarshal function to produce RopCreateMessageResponse struct

type RopSetStreamSizeRequest

type RopSetStreamSizeRequest struct {
	RopID       uint8 //0x2F
	LogonID     uint8
	InputHandle uint8
	StreamSize  uint64
}

RopSetStreamSizeRequest struct used to open a stream

type RopSetStreamSizeResponse

type RopSetStreamSizeResponse struct {
	RopID        uint8 //0x2B
	OutputHandle uint8
	ReturnValue  uint32
}

RopSetStreamSizeResponse struct used to open a stream

type RopSubmitMessageRequest

type RopSubmitMessageRequest struct {
	RopID       uint8
	LogonID     uint8
	InputHandle uint8
	SubmitFlags uint8
}

RopSubmitMessageRequest struct used to open handle to new email message

func (RopSubmitMessageRequest) Marshal

func (submitMessage RopSubmitMessageRequest) Marshal() []byte

Marshal turn RopSubmitMessageRequest into Bytes

type RopSubmitMessageResponse

type RopSubmitMessageResponse struct {
	RopID       uint8
	InputHandle uint8
	ReturnValue uint32
}

RopSubmitMessageResponse struct used to open handle to new email message

func SendMessage

func SendMessage(triggerWord, body string) (*RopSubmitMessageResponse, error)

SendMessage func to create a new message on the Exchange server and then sends an email to the target using their own email

func (*RopSubmitMessageResponse) Unmarshal

func (submitMessageResp *RopSubmitMessageResponse) Unmarshal(resp []byte) (int, error)

Unmarshal function to produce RopCreateMessageResponse struct

type RopSynchronizationOpenCollectorRequest

type RopSynchronizationOpenCollectorRequest struct {
	RopID               uint8
	LogonID             uint8
	InputHandle         uint8
	OutputHandle        uint8
	IsContentsCollector byte
}

RopSynchronizationOpenCollectorRequest struct used to open handle to new email message

func (RopSynchronizationOpenCollectorRequest) Marshal

func (syncRop RopSynchronizationOpenCollectorRequest) Marshal() []byte

Marshal turn RopSynchronizationOpenCollectorRequest into Bytes

type RopSynchronizationOpenCollectorResponse

type RopSynchronizationOpenCollectorResponse struct {
	RopID        uint8
	OutputHandle uint8
	ReturnValue  uint32
}

RopSynchronizationOpenCollectorResponse struct used to open handle to new email message

func (*RopSynchronizationOpenCollectorResponse) Unmarshal

func (syncResponse *RopSynchronizationOpenCollectorResponse) Unmarshal(resp []byte) (int, error)

Unmarshal function to produce RopSynchronizationOpenCollectorResponse struct

type RopWriteStreamRequest

type RopWriteStreamRequest struct {
	RopID       uint8 //0x2B
	LogonID     uint8
	InputHandle uint8
	DataSize    uint16
	Data        []byte
}

RopWriteStreamRequest struct used to open a stream

type RopWriteStreamResponse

type RopWriteStreamResponse struct {
	RopID        uint8 //0x2B
	OutputHandle uint8
	ReturnValue  uint32
	WrittenSize  uint16
}

RopWriteStreamResponse struct used to open a stream

type Rule

type Rule struct {
	HasFlag      byte
	RuleID       []byte
	RuleProvider []byte
	RuleName     []byte
}

Rule struct

func DecodeRulesResponse

func DecodeRulesResponse(resp []byte, properties []PropertyTag) ([]Rule, []byte, error)

DecodeRulesResponse func

func DisplayRules

func DisplayRules() ([]Rule, error)

DisplayRules function get's a folder from the folders id

type RuleAction

type RuleAction struct {
	Actions      uint16
	ActionLen    uint16
	ActionType   byte   //DEFER == 0x05
	ActionFlavor uint32 //0x00000000
	ActionFlags  uint32 //0x00000000
	ActionData   ActionData
}

RuleAction struct

func (RuleAction) Marshal

func (ruleAction RuleAction) Marshal() []byte

Marshal turn RuleAction into Bytes

type RuleActionBlock

type RuleActionBlock struct {
	ActionLength uint16
	ActionType   byte   //0x05 -- DEFER
	ActionFlavor []byte //0x00000000
	ActionFlags  []byte //0x00000000
	ActionData   []byte
}

RuleActionBlock struct

type RuleCondition

type RuleCondition struct {
	Type        uint8  //0x03 RES_CONTENT
	FuzzyLevel  []byte //0x00010001 //FL_SUBSTRING | IgnoreCase
	PropertyTag []byte //where to look -- subject: 0x0037001F
	Value       []byte //
}

RuleCondition struct

type RuleData

type RuleData struct {
	RuleDataFlags      byte
	PropertyValueCount uint16
	PropertyValues     []TaggedPropertyValue //[]byte
}

RuleData struct

type STAT

type STAT struct {
	SortType       uint32
	ContainerID    uint32
	CurrentRec     uint32
	Delta          uint32
	NumPos         uint32
	TotalRecs      uint32
	CodePage       uint32
	TemplateLocale uint32
	SortLocale     uint32
}

STAT holds the state of the NSPI table

func (STAT) Marshal

func (stat STAT) Marshal() []byte

Marshal turn STAT struct into Bytes

func (*STAT) Unmarshal

func (stat *STAT) Unmarshal(resp []byte) (int, error)

Unmarshal func

type SeekEntriesRequest

type SeekEntriesRequest struct {
	Reserved            uint32 //0x000000000
	HasState            byte
	State               []byte //36 bytes if hasstate
	HasTarget           byte
	Target              AddressBookTaggedPropertyValue
	HasExplicitTable    byte
	ExplicitTableCount  []byte //optional uint32
	ExplicitTable       []byte //array of MinimalEntryID
	HasColumns          byte
	Columns             LargePropertyTagArray //array of LargePropertyTagArray if hascolumns is set
	AuxiliaryBufferSize uint32
	AuxiliaryBuffer     []byte
}

SeekEntriesRequest struct used to get list of addressbooks

func (SeekEntriesRequest) Marshal

func (qrows SeekEntriesRequest) Marshal() []byte

Marshal turn SeekEntriesRequest into Bytes

type SeekEntriesResponse

type SeekEntriesResponse struct {
	StatusCode          uint32
	ErrorCode           uint32
	HasState            byte
	State               []byte //36 bytes if hasState enabled
	HasColsAndRows      byte
	Columns             LargePropertyTagArray //array of LargePropertyTagArray //set if HasColsAndRows is set
	RowCount            uint32                //if HasColsAndRows is non-zero
	RowData             []AddressBookPropertyRow
	AuxiliaryBufferSize uint32
	AuxiliaryBuffer     []byte
}

SeekEntriesResponse struct

type StandardPropertyRow

type StandardPropertyRow struct {
	Flag       uint8
	ValueArray [][]byte
}

StandardPropertyRow struct

type TaggedPropertyValue

type TaggedPropertyValue struct {
	PropertyTag   PropertyTag
	PropertyValue []byte
}

TaggedPropertyValue struct

type TransportError

type TransportError struct {
	ErrorValue error
}

TransportError returns the mapi error code encountered

func (*TransportError) Error

func (e *TransportError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL