How to get PidTag properties from Exchange via Graph API - outlook

I want to read PidTag properties from a specific e-mail message via Graph API REST call.
For singleValueExtendedProperties that is no problem as each of them has a specific GUID and in the filter query parameter can easily search for id with the corresponding property.
However I can't do the same with PidTags (i.e. the PidTag PidTagAccess or as OutlookSpy would show it: PR_ACCESS) because all of those PidTags have only the following attributes:
Tag num: HEX
Tag sym: String
Type: PropertyType
Value: Int
Does anyone have an idea how I could get those PidTags from an Outlook message?
I tried to put different types of attributenames into the filter query that weren't listed in the api and didn't really expect it to work. But it's better to try something out rather than to assume it won't work.

Use the proptag format to access properties predefined by MAPI, or by a client or server, and that have not already been exposed in Microsoft Graph. These properties have property identifiers in the 0x0001-0x7fff range. You can find more information about that in the Outlook extended properties overview.
Each predefined property in MAPI has well-defined description in MSDN with a property type, description and its identifier. For example, take a look at the PidTagAccess property description where you can get the required information. In OutlookSpy you may find the same information I believe.

Identifier for PidTagAccess is 0x0FF4 and type is integer, so valid id format for singleValueExtendedProperties is '{type} {proptag}'
Query to read the property:
https://graph.microsoft.com/v1.0/me/messages/{message_id}?$expand=singleValueExtendedProperties($filter=id eq 'Integer 0x0FF4')

Since you are already using OutlookSpy (I am its author), you can build your Graph queries with any MAPI properties in OutlookSpy: click Message button in the Graph group on the OutlookSpy ribbon, click "Query Parameters", check "$expand" checkbox and click the button to the right of the edit box.
In your particular case (PR_ACCESS MAPI property), the query will be singleValueExtendedProperties($filter=id eq 'Integer 0x0FF4')

Related

Unable to fetch received-by of a message via Microsoft Graph

Based on my previous question, I'm trying to fetch messages from a particular folder like Deleted Items.
I am following this document to achieve the above scenario: https://learn.microsoft.com/en-us/graph/api/user-list-messages
GET https://graph.microsoft.com/v1.0/me/mailFolders/deleteditems/messages
Using the above query, I'm getting all deleted messages with a lot of information(html code) that I don't want.
I want to customize the response by retrieving only particular attributes like subject, importance, sender, sentDateTime, receiver, receivedDateTime.
I tried to query something like below using $select:
GET https://graph.microsoft.com/v1.0/me/mailFolders/deleteditems/messages?$select= subject, importance, sender, sentDateTime, receiver, receivedDateTime.
But I'm getting 400:BadRequest error like below:
{
"error": {
"code": "RequestBroker--ParseUri",
"message": "Could not find a property named 'receiver' on type 'Microsoft.OutlookServices.Message'.",
"request_id": "54f9adf-7435-5r8c-a3g6-48gx6343ac",
"date": "2022-05-24T07:35:06"
}
}
How to include receiver details along with sender details???
I tried to reproduce the same in my environment and got the same error.
As I already mentioned in the comment, there is no such attribute named 'receiver'. To resolve the error, try removing that receiver in the query and check the response.
If you want to include receiver details along with sender details, you can try including toRecipients that gives info about receiver like below as an alternative:
GET https://graph.microsoft.com/v1.0/me/mailFolders/deleteditems/messages?$select=subject,importance,sender,sentDateTime,receivedDateTime,toRecipients
Response:
UPDATE:
As #Dmitry Streblechenko mentioned, this only works when you are the only receiver of those messages. If there are multiple recipients, take a while to know MAPI properties and OutlookSpy as he suggested.
Firstly, there is no receiver property. Since the message comes from a mailbox that you explicitly connect to, wouldn't receiver be the mailbox owner? Unless the message was dragged from another mailbox in Outlook.
Note that you can always request any MAPI property in your Graph query. In your particular case, you probably want PR_RECEIVED_BY_NAME / PR_RECEIVED_BY_EMAIL_ADDRESS / PidTagReceivedRepresentingSmtpAddress MAPI properties. To retrieve PidTagReceivedRepresentingSmtpAddress property, use
?$expand=singleValueExtendedProperties($filter=id eq 'String 0x5D08')
You can see available MAPI properties as well as construct a Graph query that requests them in OutlookSpy (I am its author) - click IMessage button to see all available MAPI propetrties of a selected message or click Message (Graph) | Query Parameters | Expand.

Azure AD graph API to filter users with onPremisesExtensionAttributes [extensionAttribute6]

I need to filter users with the onPremisesExtensionAttributes [extensionAttribute6] is there a graph API call for it?
As #Tinywa suggested in the comment:
onPremisesExtensionAttributes contains extensionAttributes 1-15 for
the user. Note that the individual extension attributes are neither
selectable nor filterable.
You can get all the results first and use your own code logic to filter them.
Or you can consider using extensionProperty as a workaround. Create the extensionProperty and assign value for the users, and then query users with filtering with this extensionProperty. For detailed steps to create extensionProperty and assign value for users, you can refer to this answer.
It looks like they've updated the BETA Graph API so that extension attributes (onPremisesExtensionAttributes) are now filterable.
Try the below in Graph Explorer. You'll need to change the extensionAttribute1 eq 'Employee' part to a query that will actually work in your active directory environment.
https://graph.microsoft.com/beta/users?$count=true&$filter=onPremisesExtensionAttributes/extensionAttribute1 eq 'Employee'&$orderBy=displayName&$select=displayName,mail,onPremisesExtensionAttributes
Please note that this is the BETA Graph API so I guess that means Microsoft hasn't finalized it, so it might change or never get fully released.
EDIT: I also just learned that if you're using this filter via the Graph API, you must add the following header or you'll an error:
client.DefaultRequestHeaders.Add("ConsistencyLevel", "eventual");
The Graph Explorer has this header by default, I guess.
Here's where I found this answer: Get Extended Properties on User using Microsoft Graph
Here's the error I was getting:
Property 'extensionAttribute1' does not exist as a declared property or extension property.

How to retrieve addresses using the odata endpoint

I'm trying to retrieve an address on a standard entity.
the request is the following :
https://mycrm.api.crm4.dynamics.com/api/data/v9.1/contacts(guid)
In this example, I get all fields, but the ones that is of interest to me is address1_addressid, which seems to be a Guid, referencing some of record, but I cannot find it in the "Many to One" relationship list I retrieved using the following command :
https://mycrm.api.crm4.dynamics.com/api/data/v9.1/EntityDefinitions(LogicalName='contact')?$select=LogicalName&$expand=ManyToOneRelationships($select=ReferencingAttribute,ReferencedEntity)
I would like to retrieve those addresses in a generic manner, as I'm working on a generic NetStandard 2.0 library. I won't be able to know on which entity I'll be working, and thus won't be able to hard-code a list of addresses field names.
Here's one way to find the Contact to Address relationship:
https://myOrg.api.crm.dynamics.com/api/data/v9.1/EntityDefinitions(LogicalName='customeraddress')?$select=LogicalName&$expand=ManyToOneRelationships($select=ReferencingAttribute,ReferencedEntity)
I got an error with https://myOrg.api.crm.dynamics.com/api/data/v9.1/contacts(guid)?$expand=address1_addressid.
I looked into the MetaData and discovered that address1_addressid has a type of Primary Key:
While a normal lookup field has a type of Lookup:
Considering the error message that appears when attempting to expand address1_addressid, I think the issue is address1_addressid's data type.
Property 'address1_addressid' on type 'Microsoft.Dynamics.CRM.contact'
is not a navigation property or complex property. Only navigation
properties can be expanded.
It would seem that rather than using $expand to get the address details, you'd have to make a separate call for it:
https://myOrg.api.crm.dynamics.com/api/data/v9.1/customeraddresses(guid)
UPDATE
By reviewing the full Contact-Address relationship, via this query: https://myOrg.api.crm.dynamics.com/api/data/v9.1/EntityDefinitions(LogicalName='customeraddress')?$select=LogicalName&$expand=ManyToOneRelationships.
I discovered the ReferencedEntityNavigationPropertyName was set to Contact_CustomerAddress.
The error message before talked about the Navigation property so I gave it a shot. Using that property named allowed me to expand the Address info from the Contact:
https://myOrg.api.crm.dynamics.com/api/data/v9.1/contacts(guid)?$expand=Contact_CustomerAddress
Interestingly, expanding that navigation property returns all 3 customer addresses:

InstallShield: Get the organization name during installation

I'm creating an installation with instalshield.
In the "Installation Interview", (which is part of the "Project Assistant") I set the option "to prompt users to enter their Company Name".
My question is: how can I interact with the value they entered? I mean how can I get it? I need to take this value and insert it to my app config file , during the installation process.
In a more general way, I would love to know how can I add text fields of my own and interact with the values the customers insert?
Thank you,
Noam
Look at the installation Wizard Noam. Anywhere you see an edit control, you will notice that it has a property associated with it. The property is a 'variable' that will have a value assigned to it. You can use the property to populate a registry, an XML file, etc.
I would look through the help documentation for InstallShield relating to Properties.
http://helpnet.flexerasoftware.com/isxhelp19/helplibrary/IHelpISXPropertiesUse.htm
The link above goes over the difference between Public and Private properties and how you can use them.
Ok, so I sort of solved it, I didn't use any built in dialog boxes, but simply created my own public property and dialog, then added an event to dialog and finally read the property value with powershell script, in more details (for future noobies) :
Create new property in Property Manager (under "Behavior and Logic"), give it a name and default value.
Create new dialog (under "User Interface").
At the behavior section of your dialog go to "Next" control (for example).
Add event (by pressing the tiny green plus sign at the line of the "Events")
Choose "SetProperty"
At the SetProperty line you can specify a condition, for example ApplicationUsers = "AllUsers"
At the "Property" field enter the property name (from first instruction)
At the "Value" field enter the value you wish for.
For getting the property value from powershell, create powershell script with the following: $value = Get-Property -Name PROPERTY_NAME
That's it.
This is not exactly what I asked for in the question but I believe this answer is more general and so also contains the answer to my original question.

Has anyone used the ConstraintRelationship class for Dynamics CRM?

As documented here there is a property on the AppointmentRequest class for the CRM webservice that allows you to add constraints to what possible appointments are returned from a search.
The actual constraint is specified as an xml string, but I can find almost no documentation about it. Can any one point me to any relevant resources?
I was never able to find any quality documentation on this property or an accepted schema. About all that is available (that I've found) exists on this example from the SDK: Schedule A Resource
You can kind of see how you would limit the search results to a set of resources/users. The list of which properties can be replaced for "name" in the example is in the article ConstraintRelation.Constraints Property.
Hope this helps...

Resources