How can retrieve email address from the Infopath people/Group picker - sharepoint-2010

How can retrieve email address from the Infopath people/Group picker?When I add the people/Group picker into the infopath form, I only get 3 fields DisplayName,AccountId,AccountType.Can anyone show me how can I get the email either by configurations or by code.

In SharePoint Designer, when setting up a workflow to respond to an InfoPath people picker field, I simply map the "TO:" field of my "Send Email" action to whatever people picker field I have (even if it's set to pull the Display Name)... and the email will successfully send out regardless. Now, your mileage may vary and perhaps it's due to our Exchange server settings and small company size which allows this to work.
Anyways, try it out. Maybe extracting an email address from the people picker is a superflous step.

I have a simpler solution.
Assume you are using the connection wizard to send an email to a person selected from a people picker.
in the to field -
concat(substring-after(AccountId, "\"), "#domain.com")
assuming your companies mail accounts have an entry for username # domain.
because AccountId = domain\username
so we end up with username#domain.com
Worked for me

Create a button and the following rules for that button.
Create a data Connection to retrieve from GetUserProfileByName.
Create a field to store the email you are retrieving.
Rules for the button
Rule 1 Set a fields value. Set the value of the AccountName of GetUserProfileByName to equal the AccountID from the people picker.
Rule 2 Add an Action to to Query the Data Connection GetUserProfileByName
Rule 3 set a fields value to the email address of the query you just performed
Filter Data
Change value to name

If you simply want to populate a field with the email address from your domain this works perfectly. I have been banging my head on the double eval trick for two days. I got it to work but the form rendering in SharePoint took 2 minutes and 46 seconds.

I know this is too late for the answer but still i am writing this so that someone can get help in future.
When we keep People picker it gives us three values which you specified (AccountId, DisplayName and AccountType).
Now if some one wants to retrieve the email address, there may be so many requirement but i guess most of the person want to send mail to the user which are selected into people picker.
If you want to send mail to selected user then you can just use AccountId field into your workflow item. SharePoint designer automatically detect the email address from the AccountId and sends the mail.
I hope this might save someone's time.

Related

Outlook VBA - Function to retrieve Display Name of an email address

Apologize as I come up without any code, I just simply don't know how to start.
So let say I have an email address. I want to check whether this email address belongs to any contact in any contact folder or in any address book of my Outlook. If yes, I want to retrieve the associate Display Name of the email address. I need the function fast enough to check long list of email addresses.
Hope somebody can help. Thanks.
Try to call Namespace.CreateRecipient / Recipient.Resolve, then read Recipient.Name property. Note that it is not unique.
If you need to resolve multiple entries, create a temporary message, add the values to the MailItem.Recipients collection, call Recipients.ResolveAll.

Populating Fields in InfoPath using the People Picker

I've got an InfoPath form and have set up a Data Connection to enable me to retrieve details of a persons account using the people picker.
I've got the First Name/Last Name/Department and Job Title. When I open up the People Picker the only fields I'm getting are Display Name/AccountId and Account Type (as pictured).
Is there a way of getting the information I want?
You can try to get it with the UserProfile webservice of sharepoint. (_vti_bin/UserProfileService.asmx)
f.e:
https://blogs.technet.microsoft.com/anneste/2011/11/02/how-to-create-an-infopath-form-to-auto-populate-data-in-sharepoint-2010/
For anyone still looking for an answer to this:
Unfortunately the UserProfile webservice no longer works in Sharepoint online and produces error 5566.
The best work around for this I've found would be to use a data connection to the hidden User Information List on the root of your page.
So step-by-step:
Add a new data connection for User Information List at the stem of your site
Select the needed fields (in your case First_name, Last_name, Department and Title)
Leave "Store a copy of the data in the form template" unchecked and click "Next >"
Uncheck "Automatically retrieve data when form is opened" to query based on selected users, instead of downloading all user data
Create Rule on change (no condition) on your First and Last Name fields and run the following actions in them:
Set a field's value for first and last name:
in "Field" select queryFields First_name/Last_name of your data connection
in "Value" select your first/last name field
Query using a data connection your Sharepoint List data connection or to User Information List data connection to find any user in the members AD group
Set a field's value on your people picker:
in "Field" select the Displayname of your forms people picker (only available in advanced view)
in "Value" select the dataFields > People Picker > Displayname of your data connection
Hope that helps, I'll edit to include pictures soon.
Please let me know if you wanted to set First name, Lastname, Department and Job title based on the people picker, because this would also be possible. Thank you in advance!

Nintex Mask Context item URL

I have created an email to send a notification when a list item has been modified.
The email should send a link to the item using Context Item URL. So far I have the email ending the URL , but is there anyway I can mask it so it just displays a hyperlink "View Here" rather than the whole url string ?
I have been trying for hours and have no Idea how to do this.
Thank you for your help
As usual as soon as I posted this I found the answer.
This turned out to be a peculiarity with SharePoint where it didn’t give any prompt or indications that you had to double click not just select an item.
1 Insert link
2 Place place you mouse in Address
3 Double Click the Context Item URL
4 Field Populates & enter the display name.

How to generate adidional fields inside Yii form

I have:
Table "user"
id, username, password
Table "freedate"
id, user_id, start_date, end_date
Each user can have 1 or more (unlimited) number of "freedate" entries.
Now i have form with 2 text fields (username and password), and 2 date pickers (one for start date and another one for end date).
How can i enable user to inserd aditional datepicker pairs so they can enter as much of "freedate" entires as they need to?
I was wondering about insertind aditional button inside form, that would somehow create aditional fields when pressed, but u have no idea how to do it.
I don't need working example (even tho one would help ofc). What i need i suggestion from your own expirience if you had similar problem.
You can use javascript as noted above. Though that can get tricky to get the new fields associated with the datepicker.
You can also submit after each pair is entered. On returning back to form after save insert a new set of start/end date fields to the end of the form. This way they always have a freedate pair they can enter. (a bit slower overall)
You need javascript to generate these fields on the fly. Or a fixed amount of extra fields could be hidden and shown one by one using javascript as the user clicks the button. You would need to keep track of the number of fields being shown in a javascript var.
You need to write custom javascript in order to do that. It isn't hard, you would need to do something along these lines:
You need to create a button and, when that button gets clicked (onClick event or jquery click() function) you can add the html for your field (<input type=.... /> and so on to your form) and remember to use the correct name for these fields so that they get sent correctly when the user submits the form.

Add link to contacts in outlook Appointment Module Form using custom fields

I'm a long date leecher of this site... this is the first time I'm not able to find a response (Google didn't help too).
Well, what I am trying to do is to add an active link to a contact to a custom field in an Appointment Module Form.
I can put the address I want in the appointment custom fields using this code (vb.net):
Dim extendedPropertyDefinition = New ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "MyField", MapiPropertyType.String)
item.SetExtendedProperty(extendedPropertyDefinition, "address#iwant.com")
I am able to view MyField using a custom field in my Appointment Module Form.
Setting "To" field to the value (in custom field properties) i can transform the e-mail into the corresponding contact name (obviously if it exists in contacts list).
Here comes the trouble:
I would like to add a link to contact card when clicking the contact name.
I don't really know if it is even possible...
Thank you very much for any help... "It is not possible" will be an appreciated response too.