Scripts not working after TFS 2015 to 2018 upgrade - tfs

I am trying to make a full upgrade ftom TFS 2015 to TFS 2018.
In my TFS 2015 I had some customizations which run some scripts.
Some of them I managed to make them work but I am stuck with some which don't work.
I think it's because in my TFS 2018 I am missing some dlls:
Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll
Microsoft.TeamFoundation.Controls.dll
Microsoft.TeamFoundation.OfficeIntegration.Common.dll
Microsoft.TeamFoundation.OfficeIntegration.Common.tlb
Microsoft.TeamFoundation.OfficeIntegration.Excel.dll
Microsoft.TeamFoundation.OfficeIntegration.PowerPoint.dll
Microsoft.TeamFoundation.OfficeIntegration.Project.dll
Microsoft.TeamFoundation.ProjectManagement.dll
Microsoft.TeamFoundation.Sync.Mapping.dll
Microsoft.TeamFoundation.Sync.Project.Server.Library.dll
Microsoft.TeamFoundation.Sync.ProjectServerApi.dll
Microsoft.TeamFoundation.Sync.Shared.dll
Microsoft.TeamFoundation.TestManagement.Controls.dll
Microsoft.TeamFoundation.WorkItemTracking.Controls.dll
Microsoft.TeamFoundation.WorkItemTracking.ControlsCore.dll
Microsoft.TeamFoundation.WorkItemTracking.Proxy.dll
Microsoft.VisualStudio.Services.Client.dll
Microsoft.WITDataStore32.dll
My scripts are running with Powershell. In TFS 2015 everything was working ok but now If I try to run them with the TFS 2015 dlls I get a lot of errors. Like this:
Cannot process command because of one or more missing mandatory parameters: Credential.
at Get-RestApiCredentials,
C:\Program Files\TFSPowerShell\Modules\Ecom.TFS\Ecom.TFS.Utils.psm1: line 21 at Get-SonarEndpointId,
C:\Program Files\TFSPowerShell\Modules\Globo.TFSSetup\Globo.TFSSetup.psm1: line 23 at New-GloboBuildDefinition,
C:\Program Files\TFSPowerShell\Modules\Globo.TFSSetup\Globo.Builds.psm1: line 93 at Provision-Release,
C:\Program Files\TFSPowerShell\Modules\Globo.TFSSetup\Globo.Releases.psm1: line 99
or this:
TF400813: Resource not available for anonymous access. Client authentication required. - Microsoft Team Foundation Server body,button
{ font-family:
{ background: transparent; border: 0; color: #106ebe; cursor: pointer; } function toggle(event) { if (!event.key || event.key === " "
|| event.key === "Spacebar" || event.key === "Enter") { var icon = document.getElementById("moreInfoIcon"); var section = document.getElementById("moreInfo");
var wasShowing = section.style.display === ""; icon.src = wasShowing ? "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAABGdBTUEAALGPC%2
FxhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAABl0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuODc7gF0AAAB2SURBVDhPY2AYBThDoKWlJa2jo0OO7CBaunTpfxAGGmRCliEgzc%2BePfs%2Ff%2F78%2F01NTZokGwI
yAARAhkybNo10Q2AGwAwBeuV%2Fa2urHtEuWb58OWUuABkAC4Pm5mY7om2GKQQZAMJkaQYZAgx5P4rSAclOHjANAOQrXesb81M5AAAAAElFTkSuQmCC" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABA
AAAAQCAYAAAAf8%2F9hAAAABGdBTUEAALGPC%2FxhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAABl0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuODc7gF0AAABCSURBVDhPY2AYBfQJATU1NWsgLifLNhUVFVeg5v8gTLIBM
M2RkZGkG4CsmWQD0DWTbAAowGD%2BRqLJC0SSA24EagAAq9sjtZrUZogAAAAASUVORK5CYII%3D"; section.style.display = wasShowing ? "none" : ""; event.target.setAttribute("aria-expanded",
String(!wasShowing)); } } Error The page you are looking for is currently unavailable. TF400813: Resource not available for anonymous access. Client authentication required.
More information about this error TF400813: Resource not available for anonymous access. Client authentication required. Things you can try:
Refresh the current page Go back to the previous
page Sign in as a different user Submit feedback to Microsoft about this error Microsoft Visual Studio Team Foundation Server © Microsoft Corporation. All rights reserved.
at Get-SonarEndpointId,
C:\Program Files\TFSPowerShell\Modules\Globo.TFSSetup\Globo.TFSSetup.psm1: line 26 at New-GloboBuildDefinition,
C:\Program Files\TFSPowerShell\Modules\Globo.TFSSetup\Globo.Builds.psm1: line 93 at Provision-Release,
C:\Program Files\TFSPowerShell\Modules\Globo.TFSSetup\Globo.Releases.psm1: line 99
But note that this same scripts were working fine in TFS 2015.
So I tried to change the dlls used by this scripts. After that I get no errors but they are not working as they should.
So I am trying to get the missing dlls but my TFS 2018 doesn't have them. How can I get them?

Related

RDOSession.LogonExchangeMailbox doesn't try to login

I have a project that I have to migrate from Windows Server 2013 to Server 2016.
This project use Redemption 4.2 to send the mail. But it works on 2013 but not in 2016
My server Exchange is 2010.
My code
Public RDOSession As Redemption.RDOSession
Set RDOSession = CreateObject("Redemption.RDOSession")
Ecrire_Log "Avant RDOSession.LogonExchangeMailbox"
RDOSession.LogonExchangeMailbox colEmetteurTestComplet.Item(1), strServeurSMTP
Ecrire_Log "RDOSession.LogonExchangeMailbox : loggedon " & RDOSession.LoggedOn
EnvoyerMessageExchangeRDO_err:
Ecrire_Log "Fail to connect"
My log:
Avant RDOSession.LogonExchangeMailbox
Fail to connect - Err : Not logged on. Please log on first N° -2147418113 Source: Redemption.RDOSession.
It seems RDOSession can't be initialed correctly.
I found some post in SO about this problem with this but they don't help me.

TfsTeamProjectCollection does not ask for credential

Dears
Please help me with VS add-in Tfs connection question.
I've wrote VS 2017 plugin that uses TfsTeamProjectCollection class to connect to the tfs server. Tfs server is hosted in the https://dev.azure.com
However on certain computers it fails to connect to the Tfs server.
For example, I've tried to reproduce this and cleared all caches like described here. After clearing/connecting several cycles I've got the following:
VS Team Explorer is connected to the Tfs. I can checkout/checkin files, load history etc.
My add-in fails to connect with 401 non authorized error.
unity test started by VS is able to connect to the same Tfs using the same code
I've created sample console application that uses exactly the same class and method from add-in to connect and it works too.
Here is the source code I'm using to connect:
public override TfsTeamProjectCollection CreateCollection(WorkspaceInfo wi)
{
var s = (overrideConfig ?? Config);
var u = wi.ServerUri;
var vssCred = new VssClientCredentials(); // GetCredentials(s.Vsts);
Logger.Debug("getting collection for url:{0}", u);
TfsTeamProjectCollection tpc = null;
try
{
tpc = new TfsTeamProjectCollection(u, vssCred);
Logger.Debug("authenticating");
tpc.Authenticate(); // 401 non authorized exception here
}
I've tried to add vssCred.Storage = new VssClientCredentialStorage(); before Autheticate() but no luck
Then I've checked network packets using Fiddler application.
It shows the same request packet is sent using unit test, console application and add-in.
But console application and unit test produces initial request
POST
https://dev.azure.com/quipu-cwnet/Services/v3.0/LocationService.asmx
HTTP/1.1
and response is
HTTP/1.1 401 Unauthorized
X-TFS-FedAuthRedirect:
https://app.vssps.visualstudio.com/_signin?realm=dev.azure.com&reply_to=https%3A%2F%2Fdev.azure.com%2F...
Then console and unit test sends packet to the redirect url and asks for user credentials.
When add-in tries to connect to the Tfs server fiddler shows only first POST request and 401 response (with the same X-TFS-FedAuthRedirect header. But there is no redirection. From user side it looks like application freezes for some period after 401 response is obtained and then fails with 401 error.
Both Unit test and add-in assemblies has the same references to the 15.0.0 assemblies like Microsoft.TeamFoundation.VersionControl.Client and related.
I've tried VssConnection but the same
VssConnection connection = new VssConnection(u, vssCred);
connection.ConnectAsync().SyncResult();
var prj = connection.GetClient<ProjectHttpClient>();
var prjCollection = prj.GetProjects().Result; // 401 error here when is executed as VS add-in
foreach (var pc in prjCollection)
Logger.Debug("\tVssConnection project {0} {1}", pc.Id, pc.Name);
I'm using the same user to start VS (and add-in) and console. No elevated permissions.
Is there anything I can do with TfsConnection when used as VS add-in ?
the answer is to execute Authenticate() in the separate thread (non GUI) :crazy
var authTask = Task.Run(() => tpc.Authenticate());
authTask.Wait();
Please note that I'm using VS 2017 15.9.11 and Microsoft.TeamFoundationServer.ExtendedClient.15.112.1
upd1: I've upgraded Microsoft.TeamFoundationServer.ExtendedClient to 15.113.1
it works on my machine but still fails on my colleague machine.
Tfs credentials are working like a charm on both machines:
var tfsClientCredentials = TfsClientCredentials.LoadCachedCredentials(wi.ServerUri, false, false);
var res = new TfsTeamProjectCollection(wi.ServerUri, tfsClientCredentials);
res.EnsureAuthenticated();
despite the fact it is marked as obsolete.

Getting #Mention to work with a TFS Extension on TFS 2017.3

I am trying to programmatically add the mention of users that are members of groups in TFS in the discussion area of work items. We were using the 1.0 version with TFS 2017 update 2 with success:
#{id.DisplayName}
However upgrading to TFS 2017 update 3 fails to send emails on the notifications. We also tried all of the "user ids" we could find on the TeamFoundationIdentitiy object for the solutions found here:
VSTS - uploading via an excel macro and getting #mentions to work
So how can we get emails for #mentions to work again in TFS 2017.3?
Update: 9/11/2018
Verified service account fails to send emails while my account running the same code will send emails for mentions:
using (var connection = new VssConnection(collectionUri, cred))
using (var client = connection.GetClient<WorkItemTrackingHttpClient>())
{
var wi = new JsonPatchDocument
{
new JsonPatchOperation()
{
Operation = Operation.Add,
Path = "/fields/System.History",
Value = $"#{id.DisplayName} <br/>"
}
};
using (var response = client.UpdateWorkItemAsync(wi, workItemId, suppressNotifications: false))
{
response.Wait();
}
}
We solved by dropping use of the WorkItemHttpClient and going back to loading the SOAP WorkItemStore as the user that submitted the changes instead of the service account. It would be nice if we could use impersonation of a user with TFS's WebApi

Visual Studio Team Services (was VSO) SDK getProjectInfo fail when try to create TFS extension

When implement a TFS extension Widget, our team try to use some VSO API to determine the current version control tool is TFVC or Git. We found there is an API in VersionCtrlRestClient can return the project information. But the following code always fail with an 401 NOT AUTHORIZED error.
import VersionCtrlRestClient = require("TFS/VersionControl/TfvcRestClient");
versionCtrlClient.getProjectInfo("MyProjectName")
.then(projectInfo => {
var cont = $("#content");
cont.append("<pre>" + "TFVC---" + projectInfo.supportsGit + "</pre>");
cont.append("<pre>" + "GIT ---" + projectInfo.supportsGit + "</pre>");
cont.append("<pre>" + "GIT ---" + projectInfo.defaultSourceControlType + "</pre>");
});
Our extension already register into the following scope, and it is ok to call the API to query code changes from the versionCtrlClient.
"scopes": [ "vso.profile", "vso.work", "vso.work_write", "vso.code", "vso.code_write", "vso.code_manage" ]
Does anyone know what the problem is and how to make the API call "AUTHORIZED"?
PS. In the API document of getProjectInfo, it is said
* [Obsolete - Use the Projects API instead] Retrieve the version control information for a given Team Project
But where can we find the new API to replace it???
The documentation about Project API is here: CoreHttpClient2_2.
To get the version control information, you could use getProject() method with includeCapabilities option. It will returns IPromise that include the version control information.
capabilities: {[key: string]: {[key: string]: string}}. Set of
capabilities this project has (such as process template & version
control).

Get historical data in TFS 2013

I'm trying to get historical data from a server in Team Foundation server 2013, does someone know how? In TFS 2015 there is a way with AsOf but it doesn't work in the 2013 version.
Turns out, what I wanted was an endpoint.
I found one, it needs to be formatted to use the data that is there:
#{server_url}/_api/_wit/workitems?ids=#{workItem_id}
In TFS2013, you need work with TFS API to get work item historical data. You should use the WorkItem.Revisions property.
var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://tfsservername:8080/tfs/defaultcollection"));
var service = tfs.GetService<WorkItemStore>();
var wi = service.GetWorkItem(workitemid);
foreach (Revision revision in wi.Revisions)
{
//historical data
}
Have a check on this blog for the details: http://geekswithblogs.net/TarunArora/archive/2011/08/21/tfs-sdk-work-item-history-visualizer-using-tfs-api.aspx

Resources