Google Directory API: Updaing address information - google-admin-sdk

Using the Directory API I am able to update the individual address attributes e.g. streetAddress, region and postalCode.
However the 'formatted' attribute still has the old address and it is this that shows in the users Directory profile. The 'formatted' attribute is not writable so how does this get updated with the new address?

I was having trouble getting my addresses to display correctly as well. But at the time I didn't know about the "formatted" attribute. After working with support, the solution was to also update the "formatted" field with whatever you want displayed for their address. It is a writeable attribute for me.
Example:
{
"type":"work",
"formatted":"123 Nowhere Somewhereville MN 55555",
"streetAddress":"123 Nowhere",
"locality":"Somewhereville",
"region":"MN",
"postalCode":"55555"
}

Related

Import XLS/Rows Copy: How to display contact name in a Contact Column?

Seeing release 1.3.3 of the smartsheet SDK and the ability to import XLS files straight from the SDK (which I haven't tried yet), I started thinking about how I would be able to achieve my goal to upload very large sheets with a minimum number of requests.
(see related questions: Building whole sheet programmatically with Python SDK, How to create a project sheet via the python SDK)
My current test methodology is to import an XLS file (though the UI so far), which comes in not formatted properly (Trying to make a project sheet, with gantt view, and resource management).
Using the python SDK, I use the Sheets.copy_rows() method to copy the rows from the sheet that was imported in the UI, to another blank sheet that is created following my project sheet template.
This seems to work perfectly, with the exception of the contact column, in which I would like to display the contact name rather than the contact email address.
According to https://smartsheet-platform.github.io/api-docs/?python#contact-list-columns:
When creating or updating cells for a contact list column, the
displayValue attribute works as follows:
If displayValue is non-null and non-empty, the Smartsheet cell displays the value provided.
If displayValue is an empty string, the Smartsheet cell displays the email address.
If displayValue is null or absent, Smartsheet makes a best guess effort at filling it in with a contact’s name based on the email
address.
Looking at the sheet I created from the import, I can see my cell data as: {"columnId": 7027801426552708, "value": "eleroy#******.com"}.
According to the doc above, since displayValue is absent, I was hoping the copy into a contact list column would attempt to fill with the contact's name based on the email address.
Is there a way I can force it to convert to the contact's name either on XLS import or during the copy?
Edit:
As seen with some of the answers below, I guess it makes sense that the copy would copy the data as is, so I'm left trying to have it fill in the contact name on XLS import.
I am trying to find a way to inject both the display value and the value in Excel, but haven't succeeded yet. I have tried Hyperlinks, email links, =HYPERLINK() formula, but so far no success.
If you set the Value with the email address and the displayValue as the contact name, you should be able to get what you're looking for. For example, the following body of a generic HTTP request would display "MyUser Gmail" in the cell, but have the myuser#gmail as the contact email.
[
{
"toBottom": true,
"cells": [
{
"columnId": 6xxxxxxxxxxxxxx8,
"value": "myuser#gmail.com",
"displayValue": "MyUser Gmail"
}
]
}
]
If the displayValue is empty, it's an indication that this cell's Contact does not have a name associated with it. If your original sheet does include a name, the point of failure is likely in the copy process.
Without looking into the Python SDK, I might guess that copy_rows() is only copying by value and not displayValue. Try manually setting the value/displayValue of the contact cell and see if that works.

Retrieving a contact picture for a MAPI address book entry

I needed access to the private address books of a user in Windows.
The software I am working on is using C++ and using anything else is not an option.
I solved all the problems except for how to access the photos that are stored with the contacts in Outlook (or any other MAPI address book provider).
The information I need:
What format are those pictures stored in?
Which property type (PR_XXX) is my code supposed to query for?
But maybe those pictures cannot be retrieved like other properties of the contact (e.g. like surname or email address)
In case of OAB, you will need to extract the IPM.Conntact message entry id property from the address book entry id (OAB entry id format is documented on MSDN), open the message, then read its attachments. The picture attachment will have PR_ATTACHMENT_CONTACTPHOTO property set to true

Getting error while reading salesforce custom field type Rich Textarea

I am using salesforce.cfc (downloded from Riaforge) to integrate coldfusion with salesforce.
<cfset latestProductList = salesforce.queryObject("SELECT Id, Name, Description__c, Price__c, ProductImage__c FROM Product__c") />
I have created one custom object named "Product__c". This object have one custom field "ProductImage__c" type "Rich TextArea". When i an trying to get product without this custom field it is run, but when i am trying to get product with this field i am getting below error:
"INVALID_FIELD: Name, Description__c, Price__c, ProductImage__c FROM Product__c ^ ERROR at Row:1:Column:44 No such column 'ProductImage__c' on entity 'Product__c'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. "
But i have this field. attached screen image of salesforce below.
Thanks,
Arun
A quick look at Salesforce CFC shows that it hasn't been updated in a while. The file SalesForce.cfc is pointing at:
https://www.salesforce.com/services/Soap/u/11.1
That's version 11.1 of the API, which is quite old and is long before rich text fields came into existence.
You might be able to fix this issue by simply updating the reference in SalesForce.cfc to the latest version of the API by changing
https://www.salesforce.com/services/Soap/u/11.1
to
https://www.salesforce.com/services/Soap/u/28.0
in that file, although there's a pretty good likelihood that that will break something else, since version 28.0 will have lots of new stuff that SalesForce.cfc is not coded to handle.
In any case, your problem is in fact the API version that you're using. In cases like this, when a field type did not exist as of a certain API version, then that field is invisible for that version. In your case, your rich text field is invisible for your API version, 11.1.

How can I find the InternetRegistry User Key or Parent Registry Key

I have a BHO which on the first run is gathering activation information and storing this in the registry.
(I think) due to IE's permission's I am only able to store this in the registry branch
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\InternetRegistry\REGISTRY\USER\S-0-0-00-000000000-000000000-000000000-0000\Software\MyBHO\MyKey
Where S-0-0-00-000000000-000000000-000000000-0000 is a unique key for each user.
Which is fine using RegCreateKey() with "Software\MyBHO\MyKey". It's all created and running lovely. It determines where in space to store the Key with no problems.
The Problem:
When I carry out an uninstall I want to remove this key and as this is run outside of IE I have no way to determine where that key is / what the user string is.
Options I have in mind:
Option 1 (Ideal)
Find out this user string first to then build a new path for the key I wish to remove and remove it. How?
Option 2
At the point of activation store the path to the key in another registry value that can be accessed. Then read, and delete both (Which seems a bit backwards and probably wont work due to the access restrictions of the BHO on the registry (Thus it being written there in the first place))
Do you know if there is any way to find this User key or even how to find the parent dir.
Edit Upon continued research I've found that the thing I'm referring to as "user key" is the current Users "SID". Maybe this will yield me better results.
Call GetUserName to get the user name, and LookupAccountName to get his SID.
ConvertSidToStringSid is a useful utility function to format a SID as a S-1-5-32-00000000-00000000-00000000-00000000-0000 string
If you really want to write per-user data to the registry, use IEGetWriteableHKCU().
In general there is no good way to remove per-user data at uninstall. For example, what if you install as user A and the uninstall as user B? Are you going to go find all of them and delete them? Just leave the turds behind.
Alternatively you could consider using a different data store. Do you really need the registry? Can you store this data in a file? What about Web Storage?

retrieving 'pre windows 2000 logon' name from LDAPMessage object in win32api C++

I've been asked to look at windows service which retrieves data from an Active Directory tree using the win32 LDAP API and outputs JSON data to a text file. It works fine but I need to modify it so that the i get the 'pre windows 2000' login name. The service is written in c++.
The service already successfully retrieves various other attribute strings using:
PTSTR *pszValues=ldap_get_values(pLdap,pEntry,szAttribute);
and:
if (_tcscmp(szAttribute,TEXT("uUsnChanged"))==0) // uSNChanged is an example of an attribute
pItemInfo->uUsnChanged=_tcstoui64(pszValues[0],NULL,10); // pItemInfo is a struct defined elsewhere to hold the results for any given entry
i looked on http://msdn.microsoft.com/en-us/library/ms679021(v=VS.85).aspx to see if there is an attribute for 'pre windows 2000' login or something similar in the hope that I could just add this as another 'szAttribute' (to replace "uUsnChanged" in this example) and had no luck. Looking at the API i have been unable to come up with a way of getting this information.
i found the attribute 'sAMAccountName' which i thought would provide the information needed but it only gives me the name part of the DOMAIN/name format. Typical, it's the other part i want!
does anyone have any ideas on how to get the 'pre windows 2000' string from 'pEntry'?
#JPBlanc We are getting the correct nETBIOSName attribute now when running it on the test server. The app works on the assumption that there is a maximum of one nETBIOSName attribute per DC. It finds it by doing the following:
gets the default host using ldap_init(NULL,0)
get the 'configuration naming context' using ldap_search_s(pLdap,NULL,LDAP_SCOPE_BASE,NULL,pszAttrs,FALSE,&pResults); passing in the connection handle as the first parameter
retrieves the 'configurationNamingContext' attribute using ldap_get_values(pLdap,pEntry,TEXT("configurationNamingContext"));
concatenates "CN=Partitions," to the beggining of the string giving something like "CN=Partitions,CN=Configuration,DC=domain,DC=com,DC=au"
it then performs a search using ldap_search_s(pLdap,szPartitionNC,LDAP_SCOPE_SUBTREE,TEXT("(nETBIOSName=*)"),pszAttrs,FALSE,&pResults);
then it loops through the results looking for anything with a 'nETBIOSName' attribute and once it finds one it breaks out of the loop and returns the value.
Do you know if this is sufficient to work in any AD configuration?
Be careful, the Domain part of the 'pre windows 2000 domain' can be completly different from the user Principal Name (user#domain) use to logon onto Active-Directory. the DOMAIN is the Primary Domain Controleur name or the Netbios domain name. DOMAIN is created during domain creation, by default it's part of the DNS name, but it can be completly changed during domain creation.
You can find it with nETBIOSName attribute :
ldifde -f netbios.ldf -d "CN=Partitions,CN=Configuration,DC=your-DNS-Name" -r "(netbiosname=*)"
A best filter would be
(&(objectcategory=crossref)(dnsHostName=<DomainDNSName>)(netbiosname=*))
SAM-Account-Name Attribute (sAMAccountName)