Obtaining email address from TFS

Hi,

Is there any documentation or way to obtain the email address of a user stored within TFS?

Thanks for your help in advance.

Hi HumanaEMT,

Sorry I don’t know of a way of doing this at this stage. I would suggest asking on Stack Overflow, there is bound to be someone who has solved this issue on there.

HumanaEMT,

 what are you trying to do?

TFS stores the person who launched the build in BuildDetail.RequestedBy which can be passed to FinalBuilder.

Thanks,
Dave

I am attempting to notify the developer that checked in the code via email, that the build failed due to that check in. Once the resolved name or email address is obtained, it can be used as a variable for reciepent in the FB Send Email action. As it is now, I can only send the email out to an established group of people (which all developers are a member of – assigned within the ini file) instead of that one developer. I would like to send it to that singular developer who did the check in.

Thanks for your help

By the way, I can get the user ID from the FB TFS History Action but this does not provide name or email address.

You might want to use a Continuous Integration (CI) build to notify users of a failure due to a commit.

 Alternatively, there are probably several ways to get a Full name and Email address based on User ID. Google some solutions using PowerShell to query Active Directory for user information. You could also maintain your own list in a text file of user ID's and email addresses.

 Dave

Thanks. I was able to figure out a way to have FB interact with TFS to obtain the address.

Hi HumanaEMT,

I would be interested to know what the method you used was for future reference.

In the FB build

I used the TFS History action to obtain the History of the last check in from a monitored TFS path and saved that into a variable (%TFS_CheckIn_History%).

Then substringed the variable %TFS_CheckIn_History% to obtain just the UserId only into a variable (%TFS_CheckIn_User%).

Then used the action Run DOS Command prompt and invoked the TFS security utility using the following command and piping the output into 

a text file (%FBPROJECTDIR%\%BuildSolution%_Email_Addr.txt).

                Command: tfssecurity /i %TFS_CheckIn_User% /collection:http://tfsName.com:8080/tfs > %FBPROJECTDIR%\%BuildSolution%_Email_Addr.txt

                Start In: path of where tfssecurity is installed from Visual Studio (F:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE)

After the output txt file is created, I used the Read Text File Action and saved that into a variable (TFS_CheckIn_User_Email_Addr) and then substringed that variable to only give me the email address.

Now I can use the Send Email Action to send an email to the actual developer that checked in the code if there were any errors in the build asking the developer to correct.

All automated. =)

Thanks for that write up!