Getting email address of a recipient which is an exchange user - ms-office

In my VSTO Outlook 2007 plug-in, I am able to get the email address of a recipient which is an exchange user. But when I have the following case, it does not return me the smtp email:
Add a new Outlook Contact item (in Outlook contacts).
The email address of this Contact Item should be an email of an exchange user (any person of your organization, but that is an exchange user).
Now when I select this Outlook contact as email recipient and in item send event I cannot get the smtp address.
Below is my code:
Recipient r = mailItem.Recipients[i];
r.Resolve();
//Note, i have different conditions that check the AddressEntryUserType of recipient's
//address entry object. All other cases work fine. In this case this is
//olOutlookContactAddressEntry.
//I have tried the following:
ContactItem cont = r.AddressEntry.GetContact();
string email = cont.Email1Address;
string emailtmp = r.AddressEntry.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x800F101E") as string;
Can anyone please help me about what property I should use in this case to get smtp email?

I have found a way to use the ExchangeUser item and resolve the smtp address through that object. This post helped - Get Smtp email from ContactInfo stored in Exchange
foreach (Outlook.Recipient recipient in currentAppointment.Recipients)
{
Outlook.ExchangeUser exchangeUser = recipient.AddressEntry.GetExchangeUser();
string smtpAddress;
if (exchangeUser != null)
{
smtpAddress = exchangeUser.PrimarySmtpAddress;
}
else
{
smtpAddress = recipient.Address;
}
}

If I recall correctly, there were several instances where email addresses wouldn't resolve unless you SAVED the item being sent first. You might try that. Also, are you not getting any "security violation" messages asking for permission to access the user's address book, or have you disabled/worked around all that stuff? I had lots of probs with that that ended up requiring using Redemption for outlook.

Related

Unable to obtain embedded recipient view from DocuSign

I have integrated DocuSign embedded signing into my web app, which is still in development so using DocuSign developer sandbox.
When an envelope is created programmatically, I am including Name, Email and ClientUserId for the signer like this:
var signers = new List<TemplateRole>();
foreach (var r in req.Recipients)
{
var signer = new TemplateRole();
signer.ClientUserId = r.SSOUserId;
signer.Email = r.Email;
signer.Name = r.Name;
signer.RoleName = r.RoleName;
signer.RoutingOrder = r.RoutingOrder.ToString();
signer.Tabs = r.MergeFields
signers.Add(signer);
}
var env = new EnvelopeDefinition()
{
TemplateId = ...,
TemplateRoles = new List<TemplateRole>(signers),
EventNotification = ...,
Status = "Sent"
};
When an embedded recipient view is requested, I include the same exact Name, Email and ClientUserId in the request like this:
var envelopeApi = new EnvelopesApi(ApiClient);
var viewOptions = new RecipientViewRequest
{
ReturnUrl = ...,
AuthenticationMethod = "Password",
ClientUserId = recipient.SSOUserId,
UserName = recipient.Name,
Email = recipient.Email
};
var viewUrl = envelopeApi.CreateRecipientView(AccountId, DocuSignEnvelopeId, viewOptions);
Even though the user may change their Name and/or Email in my app, I have the original values saved in a table and I use those original values when requesting the view from DocuSign. This setup has worked 100% of the time for many months until now when an envelope is having trouble obtaining a recipient view. The envelope was created + viewed last week (April 27, 2022), and when the user tried to sign it today (May 4, 2022), they keep getting this error:
DocuSign.eSign.Client.ApiException: Error calling CreateRecipientView: {
"errorCode":"UNKNOWN_ENVELOPE_RECIPIENT",
"message":"The recipient you have identified is not a valid recipient of the specified envelope."
}
Note that hundreds of envelopes created before and after the above envelope are still able to obtain a recipient view with the exact same code + configuration. The problematic envelope has not expired, I can still see it in the Waiting for Others section of the DocuSign admin site. I have compared its recipient info at DocuSign (by invoking ListRecipients) with the info I have in my database, and the Name, Email, ClientUserId, RoleName, RoutingOrder all match completely. My account is set up to expire envelopes after 120 days, and I am not doing anything during envelope creation to set an expiration date. I have seen many others having this issue but typically their problem is the ClientUserId. My code has that handled, and it works for every other envelope.
The only difference I have seen between this envelope and the others is that ListRecipients results show the affected envelope as having a property
"signatureInfo": {
"fontStyle": "docusign7",
"signatureInitials": "RW",
"signatureName": "Test"
}
that is null for all other envelopes. The documentation states that this property can be set by the sender to pre-fill signature fields. However, I didn't even know about this property before today, so my app has never set it. It would be weird for this property to cause the envelope to be in a state where it cannot be signed anymore but I am struggling to find a reason why this particular envelope cannot be signed. Btw, the signatureName of Test actually matches the Name property of the recipient so its even more confusing why DocuSign is refusing to recognize the signer.
If the envelope is still active, I suggest doing a Recipients:list operation. Also check that the recipient is a "current" recipient. (If there's only one recipient, then this doesn't apply.)
If the Recipients:list doesn't give you any clues then I suggest you contact developer support. They can check our backend logs to see if there's additional information on why the RecipientsView call didn't work.
See page https://support.docusign.com/s/contactSupport?language=en_US First login to that page if you have a production account. You can get support if you only have a developer account.

nlapiSendEmail returns SSS_AUTHOR_MUST_BE_EMPLOYEE from correct employee id (on Sandbox)

in a Sandbox environment nlapiSendEmail (defined inside a suitelet) returns SSS_AUTHOR_MUST_BE_EMPLOYEE even when the sender id is correct
My distribution is Kilimanjaro, with SuiteScript 1.0. I have an administrator role, when calling nlapiSenEmail() directly from the backend model with my employee id, the email was sent to my employee profile, but not to the specified email, which is really a company distribution list. Even when I did not specify the logged customer email, a copy was sent to the logged customer email, a gmail account. The backend model operates only for the MyAccount application. It's worth noting that in this scenario nlapiSendEmail() return value was undefined. In my experience, Netsuite is really ambiguous in its behavior returning values or just functioning in an expected way, due to the "execution context". So, with the same data I put my call inside a suitelet, and now I am having the return SSS_AUTHOR_MUST_BE_EMPLOYEE.
function sendEmailWithAPI(request, response)
{
var senderId = request.getParameter('senderId');
var to = request.getParameter('emailTo');
var subject = request.getParameter('subject');
var body = request.getParameter('body');
var cc = request.getParameter('emailCC');
var result = {success:false, errorInfo:''};
try
{
var sendingResult = nlapiSendEmail(senderId, to, subject, body, cc);
result.success = true;
}
catch (errorOnMailSending)
{
result.returnValue = sendingResult;
result.errorInfo = errorOnMailSending.details;
}
response.write(JSON.stringify(result));
}
What is the record type of the senderId? NetSuite only accepts Employee records as sender of script generated emails. Also in Sandbox accounts, the emails are re-routed to the logged in user, specific list, or not at all. This is actually based on the Company preference in your Sandbox account. The reason for this is Sandbox is usually used for testing and you don't want to send test emails to actual customers.
In the end the "problem" was that I was just working in the Sandbox, as I prepared a snippet to test email sending in production everything went right. In the sandbox you can still send emails specifying a list at the subtab "Email options"
with the option "SEND EMAIL TO (SEPARATE ADDRESSES WITH COMMAS)"
this is located at Setup > Company > Email Preferences.

How to send document to client's more than one personal email ids to sign it using DocuSignAPI .NET Client?

I've setup a developer sandbox environment of DocuSign. Using its C#.NET API Client, I want to send a document for signing to client's more than one personal email ids. Once the client opens any email to see and sign it, the corresponding DocuSign envelope state should get updated to Completed.
Also, I tried to achieve the above behavior through multiple signer recipients, but the envelope state gets marked completed, when all the signer recipients sign the document. Here I want any signer recipient sign should be enough to complete the document signing workflow.
Please suggest how to get it done
Regards,
A
In order to deliver an envelope to several emails in a single role, you'll need to create a Signing Group. Signing Groups can be created and managed through the API, so you'll be able to do that programatically.
While you'll need to implement your own business logic and error checking, a sample of creating a Signing Group in c# looks like:
SigningGroup signingGroup = new SigningGroup();
signingGroup.GroupName = "SigningGroup_" + DateTime.UtcNow.Ticks.ToString();
signingGroup.GroupType = "sharedSigningGroup";
signingGroup.Users = new List<SigningGroupUser>();
SigningGroupUser signingGroupUser1 = new SigningGroupUser();
signingGroupUser1.UserName = "Example Signer";
signingGroupUser1.Email = "signer#example.com";
signingGroup.Users.Add(signingGroupUser1);
SigningGroupUser signingGroupUser2 = new SigningGroupUser();
signingGroupUser2.UserName = "Example Signer";
signingGroupUser2.Email = "personal.email#example.com";
signingGroup.Users.Add(signingGroupUser2);
SigningGroupInformation signingGroupInformation = new SigningGroupInformation();
signingGroupInformation.Groups = new List<SigningGroup> { signingGroup };
SigningGroupsApi signingGroupsApi = new SigningGroupsApi(apiClient.Configuration);
SigningGroupInformation newGroupInfo = signingGroupsApi.CreateList(accountId, signingGroupInformation);
string newGroupId = newGroupInfo.Groups[0].SigningGroupId;
To use the Signing Group in an envelope, define a signer with that group ID:
Signer signer = new Signer
{
SigningGroupId = newGroupId,
RecipientId = "1",
RoutingOrder = "1"
};
Once the envelope is created as a draft, you can then clean up the signing group:
signingGroupsApi.DeleteList(accountId, newGroupInfo);

EnsureUser using email address in SharePoint client object model

I need to update a FieldUserValue field in sharepoint 2013. i am only given an email address data. I can't user EnsureUser since it only accepts the logonName. i used the FromUser method but it gives me an error that says "the user does not exist or is not unique"
FieldUserValue user = FieldUserValue.FromUser(email);
it worked when i tried using my email address but when i use the email addresses in my data it results in an error. how do i fix the issue?
You could resolve user by email address using Utility.ResolvePrincipal method, for example:
var result = Microsoft.SharePoint.Client.Utilities.Utility.ResolvePrincipal(ctx, ctx.Web, emailAddress,Microsoft.SharePoint.Client.Utilities.PrincipalType.User,Microsoft.SharePoint.Client.Utilities.PrincipalSource.All, null, true);
ctx.ExecuteQuery();
if (result != null)
{
var user = ctx.Web.EnsureUser(result.Value.LoginName);
ctx.Load(user);
ctx.ExecuteQuery();
}
References
Get user identity and properties in SharePoint 2013

Sharepoint Designer 2007 - Form field with an ADDRESS BOOK button

I'm developing an approval workflow in SP Designer 2007. I need a form field that will allow the user to verify that they have entered a working email address from Active Directory into a form field. (This will be the email address of the user's supervisor who grants approval - if this email address is wrong the entire process is derailed). I'm thinking it would work just like the Address Book button in an email form. Or better yet, like the Check Name button that simply checks the email address currently entered and verifies it by underlining it or some other visual cue.
Seems like an obviously useful behavior - I must be missing something - I am new to SP. Thanks!
Can you not run an LDAP query using the current users username, getting the user "Manager" field. Use that to get the managers email address.
That way the user only overrides the email address if they explicitly want someone elses.
Here is a little code to help you do an LDAP query
using System.DirectoryServices;
//DirectoryEntry de = new DirectoryEntry("LDAP://wel0101");
DirectoryEntry de = new DirectoryEntry();
DirectorySearcher deSearch = new DirectorySearcher(de);
//deSearch.PropertiesToLoad.Add("Email");
SearchResultCollection results;
deSearch.SearchScope = SearchScope.Subtree;
deSearch.Filter ="(&(objectClass=user)(cn=bacchu*))";
//deSearch.
results = deSearch.FindAll();
foreach (SearchResult result in results)
{
ResultPropertyCollection props = result.Properties;
richTextBox1.Text += "------------------------\n";
foreach (string propName in props.PropertyNames)
{
richTextBox1.Text += propName + ":\"" + props[propName][0] + "\"\n";
}
}
richTextBox1.Text += "Done" + DateTime.Now.ToString() + "\n";

Resources