How to enumerate values of custom user property in Outlook C# - outlook

I have created custom user property in Outlook called "Ownership". When someone from the team claim ownership of an email, person's name is saved as its value.
My question, is there any way to enumerate all the values of this custom property into combo box.
In simple words, get a list of all team members names (whoever has claimed ownership of an email in inbox folder).
I want to do something like this.
Outlook.UserDefinedProperties userDefinedProperties = null;
Outlook.UserDefinedProperty userDefinedProperty = null;
Outlook.MAPIFolder currentFolder = application.ActiveExplorer().CurrentFolder;
mailUserProperties = currentFolder.UserDefinedProperties;
mailUserProperty = mailUserProperties["Ownership"];
// Filling up the combo box
PersonCombo.Items.Add(userDefinedProperty.Value);
I want to use current folder because folder will have all the values while an email can only have one value of the custom property.
If this is not possible, is there any other way to get it done?
Thank you in advance.

There isn't a single query that will return all unique values of a particular named property. The best you can do is search for all items where the property exists (not null), and then build a list of unique values.
I do not think, however, this is a good of storing possible values - it really must be a single source, such as a particular GAL distribution list, or a hidden (associated) message in the folder that stores all possible values in a single property.

Thanks everyone for your input.
At the end, I ended up creating GAL distribution list as Dmitry suggested and used it for my purpose.

Related

Using Exchange GetAddressEntryFromID method with LDAP msExchMailboxGuid

Outlook COM has a method under Application.Session.GetAddressEntryFromID method to grab an address entry without having to iterate through the entire Global or All Users address book.
The issue is it is expecting the ID that an entry has under the AddressLists object.
In Active Directory, there is no equivalent that gives me the same GetAddressEntryFromId string.
I was previously making a list of all users, minus rooms and resources, by going through the entire COM object, but that takes too long; 20mins.
I figured if I use AD, which is faster, with filters to find the users, then I can grab the GUID and when looking for info on the user, not have to go through the entire COM object to grab it, but it will happen locally to the executable being run.
The issue I am having, as an example, is that I have a user with the following ID;
00000000DCA740C8C042101AB4B908002B2FE18201000000000000002F6F3D45766572657374205265696E737572616E63652F6F753D436F72702D48512F636E3D526563697069656E74732F636E3D6A6E6700
In AD the msExchMailboxGuid has a value of
{4A49BD1C-62AE-4674-B097-C06528BDBEAE}
Not sure if these are the same, but I need to learn to better save it.
What else can I use, what can I do with the current time?
GAL entry id is constructed from the EX address (which is stored in the legacyDN attribute).
The entry id you have above contains the following:

Alternative for Folder.WellKnownFolderName for older Exchange versions

I use Folder.WellKnownFolderName to detect folder type, but it was introduced only in Exchange 2013. Also it doesn't work with "Clutter" folder. Can i use another Folder property to determinate exchange folder type?
Take a look at the FolderClass property. That tells you the type of folder (Mail, Calendar, etc.).
Iterate through all the WellKnownFolderNames you care about, and fetch the corresponding Folders individually by passing Folder.Bind a FolderId created with the constructor that takes a WellKnownFolderName. The FolderId of the returned Folder will have its unique ID set. Then just keep track of the FolderId-to-WellKnownFolderName mapping.

Get a list of Active Directory Users along with their Full Name and Email

I need to retrieve a list of Active Directory users and their attributes using Delphi 2010.
I've seen a few similar questions on SO (e.g. Delphi - Find primary email address for an Active Directory user), but they all seem to require the user name before any additional information can be retrieved.
I had written an article for [The Delphi Magazine] way back when..... if you have access to a backlog of those magazines, it's in issue no. 62 (October 2000) - unfortunately, it seems those back issues aren't available for purchase anymore :-(
It's too long of an article and a code sample to post here.... basically it's about wrapping the IDirectorySearch interface in a nicer Delphi-like shell. You pass in a base container where to search, you define an LDAP filter, and you define a set of attributes you're interested in - then you search and get back basically an enumerator for the results, which you can get one by one.
In the end, I discovered TJvObjectPickerDialog, part of JVCL. It wraps the Windows Select Object dialog and does everything I need with very little coding. Just set the required properties and call execute. The selected user objects are returned along with the attributes that you set in the 'Attributes' property.

Find account GUID, and Select it back using Object GUID

I am trying to select a unique identifiers for accounts from Active Directory. I found that "objectguid" attribute do identify a user uniquely, but my problem is that I don't know how to convert the retrieved value into a readable format. And then be able to select a user back using this value.
I am using spring ldap libraries, right now the "objectguid" return a char[] (15 element)
So, Does any one knows any thing that can help?
(Note, I can't use SAM Name attribute)
Thanks,
See here. It appears there are two string formats: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX, which you can get via new BigInteger(0, (byte[])attr.get()).toString(16), and XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX, which is the same thing plus punctuation.

Magento View 'Company Name' Instead Of First/Last Name

Can Magento view/manage our customers by their business name in addition to their contact names to find them easily? It is being used for B2B, so when emails go out they are pulling the customer’s name, instead of the company name which is more appropriate.
Is this a global setting?
thanks in advance.
Magento stores business name on the customer's address by default, so it's a little harder to get to.
There's no reason you cannot add another customer field to put the company name on the customer record itself. That way you'll have no problem accessing it, and can change other screens in the system to reflect it.
If you don't want to go to those lengths, you could always implement a method that pulls the company name from the default address, and save it into the session by default, for easier retrieval.
EDIT: Better idea.
Looking through the sales email templates, there are two methods that are used to grab a customer's name:
$order->getCustomerName();
$order->getBillingAddress()->getName();
I don't see any separate references to the company name, so you should be able to substitute these two methods for your own and get the desired outcome. You'll need to create your own module and override the models for customer/address and sales/order (others have covered this in depth elsewhere). Then create methods that look something like this:
public function getCustomerName() {
if($this->getBillingAddress()->getCompany()) {
return $this->getBillingAddress()->getCompany();
}
return parent::getCustomerName();
}
That's the example for sales order, modify accordingly for customer. Now your company names will be used whenever available, and when they aren't the fallback will be to the original implementation (customer name).
Hope that helps!
Thanks,
Joe
You are correct about the universal application. If you did want just the emails, the concern is whether you have access to your custom function where you need it. If there's no object handy, I'm not positive that you will be able to call just any method that you need to.
An approach that would work in this case would be to override the two objects mentioned below, but to instead add a getCompanyName method to them. That way, you'll have the right objects to call, and you can edit the emails specifically to taste.

Resources