Using TFS2018 api to retrieve solution - c#

Using the TFS2018 api is it possible to retrieve all solution files related to a specific build?

First, you need to use Get a build api to get the sourceVersion of this build:
GET http://TFS2018:8080/tfs/DefaultCollection/{project}/_apis/build/builds/{buildId}?api-version=2.0
Then, you have two choices to retrieve all files that the build use:
Use tf get command.
Use REST API to download a zip folder for the sources. The api is as below:
~
GET http://TFS2018:8080/tfs/DefaultCollection/_api/_versioncontrol/itemContentZipped?path={FolderPath}&version={sourceVersion}

Also you may try (for git):
Set "Tag sources on success" for build definition.
Get sources with tag through tfs rest api: Get a specific version

Related

Get File Path to Read in Azure Function

I want to say that I'm new to Azure functions and probably what I'm trying to do may not make sense.
Here we go.
In the function I am creating I have to import content into a database. Whenever I do this I validate if the content is new or if it is a simple update to the data.
After that I take an email template that is in the root "root/EmailsTemplate/MyTemplate.html" I fill in with the data that I collected and send.
However, I cannot access this repository directly. I've seen that I can use Environment.CurrentDirectory, Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
or also the ExecutionContext, however they all send me to the \bin\Debug\net472 execution folder. Do I have to use one of these and go back in the folders? Or is there another way? And how will it behave later in the Azure environment?
I use Azure Function V1 (.net Framework 4.7.2)
Thanks
As auburg says, set the below properties of the file can copy the file to \bin\Debug\net472 after you build the project:
And if your function app is on azure, then the content of the root directory is the files in \bin\Debug\net472.

How to generate signed URLs for Amazon S3 exposed by CloudFront using.NET

The thing I want to achieve is to generate a singedURL pointing CloudFront distribution which originates from S3 bucket.
I have managed to sign the URL which points directly to the S3 bucket as described in following AWS spec - Generate a Presigned Object URL Using AWS SDK for .NET and it worked fine.
But what I really need is to generate signed CloudFront URL.
I assume my Distribution is properly configured as I'm able to access it using (https://d298o8yem5c56d.cloudfront.net/123.pdf) assuming Restrict Viewer Access: is set to No in Behaviors settings.
After switching it to Yes it can no longer be accessed without signedURL.
I was trying to use the sample code from AWS Developer Guide: Create a URL Signature Using C# and the .NET Framework
The URL was generated, but what I get is following error message:
<Error>
<Code>AccessDenied</Code>
<Message>Access denied</Message>
</Error>
Any ideas what should I check ?
Finally I've solved the issue using the sample code from AWS Developer Guide: Create a URL Signature Using C# and the .NET Framework
The issue seem to be related to the PrivateKey.xml
Remember to replace PrivateKey.xml with your PrivateKey (which can be generated / downloaded from AWS root account settings).
As a next step it has to be converted from PEM to XML (required by .NET)
Nice and easy way to convert from PEM to XML is by using an - online converter

Azure Resource Manager - Get all the resources of a resource group

Yesterday, I was using this line of code with the version 1.5.0-preview of Microsoft.Azure.Management.ResourceManager :
var listResources =
ResourceManagementClient.ResourceGroups.ListResources(resourceGroup.Name);
Today, I have updated to version 1.6.0-preview but the fonction doesn't seem to be available anymore. Is there another way to get the list of the resources contained in a resource group ?
Now the SDK is still preview version. In the 1.6.0 preview version. It should use following code.
var listResources = resourceManagementClient.Resources.ListByResourceGroup("ResourceGroup Name");
But it still can't work correctly on my side because the API-Version is api-version=2017-05-10. I catch the request with fiddler.
The code you mentioned that use API-version
var listResources =
ResourceManagementClient.ResourceGroups.ListResources(resourceGroup.Name);
Note : Please still use 1.5.0-preview instead of 1.6.0-preview currently if you want get group resource, or give your feedback to azure sdk team . Or you can use REST API directly

GET a package from NuGetV3 API

I'm interested in writing a client library for the NuGet v3 API in a non-.NET language.
What are the requests required to get a package, and what does the response looks like?
i.e.
GET {package-versions}
GET {package-version}
Can you also link to the official documentation that covers this scenario?
Here is the official NuGet V3 API documentation. The API is composed of multiple protocols, including:
The PackageBaseAddress - The store that contains the actual packages and their manifest files (the nuspec).
The Service Index - used by the client to discover the NuGet services
The Search Service - used by clients to search for NuGet packages
The Registration - A json-LD based structure that stores the packages' metadata. This includes packages' content, dependencies, descriptions, etc...
For example, say you wanted to download the package "Newtonsoft.
Json":
Get the service index: `GET https://api.nuget.org/v3/index.json
The response contains the address of the PackageBaseAddress (aka, incorrectly as the flat container, as it is hierarchical and not flat :) ):
{
"#id": "https://api.nuget.org/v3-flatcontainer/",
"#type": "PackageBaseAddress/3.0.0",
"comment": "Base URL of Azure storage where NuGet package registration info for DNX is stored, in the format https://api.nuget.org/v3-flatcontainer/{id-lower}/{version-lower}.{version-lower}.nupkg"
},
Use the uri provided by the #id as a base uri to list the versions of the desired package: GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json, note that this uri is subject to change and is not part of the API
Use the same base uri to download a package: GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/6.0.4/newtonsoft.json.6.0.4.nupkg
You may also want to look at the NuGet client. The client's source code is
here; you'll want to start from the NuGet.CommandLine project and walk your way down the stack.

magmi data pump api from c# - Update stock and custom attributes

I am currently using the Magento API to import stock to magento, but finding it unbelieveably slow as the number of products is mounting up!
I've heard of this Magmi Datapump API, which allows me to send a list of products, and quatities to update current products stock.. is this correct? And is there a way to call this from c# ?
Thanks
Neil
The Magmi Datapump API was written with PHP scripts in mind.
You can run Magmi using other means, such as WGET or CURL as per the Magmi Documentation
For example, by calling:
http://<your magmi dir>/web/magmi_run.php?profile=<your_profile_name>&mode=update&engine=magmi_productimportengine:Magmi_ProductImportEngine
You can initiate an import routine. Make sure you setup your profile first using the Magmi admin UI. You can simply upload a CSV file to the import directory, then set your profile to use that CSV. After calling the above URL, Magmi will open the CSV file and import the products.

Categories