Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/properties/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ There are **1078 properties**, I want to be able to:

[Protocol Buffers](https://developers.google.com/protocol-buffers/docs/proto3) is a language-neutral, platform-neutral, extensible mechanism for serializing structured data. The protocol buffer language is a language for specifying the schema for structured data. This schema is compiled into language specific bindings.

![Explanation](https://developers.google.com/static/protocol-buffers/docs/images/protocol-buffers-concepts.png)
![Explanation](https://protobuf.dev/images/protocol-buffers-concepts.png)

## Implementation

Expand Down
8 changes: 4 additions & 4 deletions cmd/properties/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func main() {
}()

properties, err := getPropertiesFromXML(unzippedFile)

if err != nil {
panic(fmt.Sprintf("Failed to create properties: %+v", errors.WithStack(err)))
}
Expand Down Expand Up @@ -118,7 +117,7 @@ func download() (destinationFilename string, err error) {
Timeout: 60 * time.Second,
}

response, err := httpClientWithTimeout.Get("https://interoperability.blob.core.windows.net/files/MS-OXPROPS/%5bMS-OXPROPS%5d-210817.docx")
response, err := httpClientWithTimeout.Get("https://msopenspecs.azureedge.net/files/MS-OXPROPS/%5bMS-OXPROPS%5d-210817.docx")

if err != nil {
return "", errors.WithStack(err)
Expand Down Expand Up @@ -393,7 +392,7 @@ func getPropertyIDFromLine(line []byte, propertyName string) (uint32, error) {
return 0, errors.WithStack(fmt.Errorf("failed to find property ID prefix for: %s", propertyName))
}

propertyID, err := strconv.ParseUint(string(propertyIDHex), propertyIDBitSize, propertyIDBitSize)
propertyID, err := strconv.ParseUint(string(propertyIDHex), 16, propertyIDBitSize)

if err != nil {
return 0, errors.WithStack(fmt.Errorf("failed to parse property ID hex to int: %w", err))
Expand Down Expand Up @@ -449,6 +448,7 @@ var propertyTypeToProtocolBufferFieldType = map[uint16]string{
64: "int64", // Time
72: "uint64",
251: "uint32",
258: "bytes",
// The rest are variable size.
}

Expand Down Expand Up @@ -483,6 +483,7 @@ var areaNameToProtocolBufferMessageType = map[string]string{
"MapiRecipient": "Message",
"MIME Properties": "Message",
"Address Properties": "Message",
"Miscellaneous Properties": "Message",
}

// referenceToProtocolBufferMessageType maps the defining reference prefix to the message type.
Expand Down Expand Up @@ -551,7 +552,6 @@ func generateProtocolBuffers(properties []xmlProperty) error {
// createProtoFileField returns the Protocol Buffer field for this property.
func createProtoFileField(property xmlProperty, protocolBufferFieldType string, uniqueFieldID int) string {
var fieldBuilder strings.Builder

if protocolBufferFieldType != "" {
// Format property name.
formattedPropertyName := getFormattedPropertyName(property.Name)
Expand Down
702 changes: 351 additions & 351 deletions cmd/properties/properties.csv

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions cmd/properties/protobufs/address_book.proto
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ message AddressBook {
optional int32 address_book_distribution_list_external_member_count = 7; // @gotags: msg:"360673,omitempty"
// Contains the total number of recipients in the distribution list.
optional int32 address_book_distribution_list_member_count = 8; // @gotags: msg:"360663,omitempty"
// Contains the name-service EntryID of a directory object that refers to a public folder.
optional bytes address_book_entry_id = 11; // @gotags: msg:"26171258,omitempty"
// Contains custom values defined and populated by the organization that modified the display templates.
optional string address_book_extension_attribute1 = 12; // @gotags: msg:"3281331,omitempty"
// Contains custom values defined and populated by the organization that modified the display templates.
Expand Down Expand Up @@ -82,8 +84,12 @@ message AddressBook {
optional bool address_book_moderation_enabled = 41; // @gotags: msg:"3602111,omitempty"
// Contains the DN of the Address Book object.
optional string address_book_object_distinguished_name = 43; // @gotags: msg:"3282831,omitempty"
// Contains a GUID that identifies an Address Book object.
optional bytes address_book_object_guid = 44; // @gotags: msg:"35949258,omitempty"
// Contains the DN of the Organization object of the mail user's organization.
optional string address_book_organizational_unit_root_distinguished_name = 45; // @gotags: msg:"3600831,omitempty"
// Contains the EntryID of the parent container in a hierarchy of address book containers.
optional bytes address_book_parent_entry_id = 48; // @gotags: msg:"65532258,omitempty"
// Contains the phonetic representation of the PidTagCompanyName property (section 2.639).
optional string address_book_phonetic_company_name = 49; // @gotags: msg:"3598531,omitempty"
// Contains the phonetic representation of the PidTagDepartmentName property (section 2.672).
Expand All @@ -110,4 +116,14 @@ message AddressBook {
optional int32 display_type = 67; // @gotags: msg:"145923,omitempty"
// Contains an integer value that indicates how to display an Address Book object in a table or as a recipient on a message.
optional int32 display_type_ex = 68; // @gotags: msg:"145973,omitempty"
// Contains a series of instructions that can be executed to format an address and the data that is needed to execute those instructions.
optional bytes script_data = 69; // @gotags: msg:"4258,omitempty"
// Contains a recording of the mail user's name pronunciation.
optional bytes spoken_name = 70; // @gotags: msg:"36034258,omitempty"
// Describes the controls used in the template that is used to retrieve address book information.
optional bytes template_data = 71; // @gotags: msg:"1258,omitempty"
// Contains the value of the PidTagEntryId property (section 2.683), expressed as a Permanent Entry ID format.
optional bytes templateid = 72; // @gotags: msg:"14594258,omitempty"
// Contains the mail user's photo in .jpg format.
optional bytes thumbnail_photo = 73; // @gotags: msg:"35998258,omitempty"
}
Loading