Create a VSTS wiql file using VSTS APi - tfs

There are APIs to query using an existing wiq file.
I want my app to create actual wiq files in a shared folder - which can be accessed outside my app too. But I cannot find any API to do that.

What's that mean for wiql files here?
WIQL is Work Item Query Language, if you mean create a query with WIQL and save the query as a file, then no any API to do that, however you can try below steps:
Create a query with the Query Editor, save the query.
Open the query in Visual Studio --> Edit Query
File -> Save {Query}[Editor] as...
Then you can open and edit the saved *.wiq file with text editor, then save/copy to a shared folder...
Reference below articles:
Export a query
Quickly generate Work Item Query for use in the TFS API

Yes, there is an API, see Create a query in the REST API.
The POST body should contains the WIQL Query and the name for it.
{
"name": "All Bugs",
"wiql": "Select [System.Id], [System.Title], [System.State] From WorkItems Where [System.WorkItemType] = 'Bug' order by [Microsoft.VSTS.Common.Priority] asc, [System.CreatedDate] desc"
}
To invoke the REST API, I suggest you to use a Microsoft library instead of writing all the code yourself, e.g. https://learn.microsoft.com/en-us/vsts/integrate/concepts/dotnet-client-libraries.

Related

Is it possible to select all files (files only) in a location using the Graph API?

I'm attempting to use the Graph API to select all folders and files for a SharePoint location.
I can use the following call to get a list of all driveItems (folders and files) in a location:
/drives/{drive-id}/root/children
I can extend this call to make it so it returns only items with the "folder" facet, meaning I can select all driveItems that are folders in this location:
drives/{drive-id}/root/children?$filter=folder ne null
What I want now is to be able to extend the original call so that it selects all driveItems with the "file" facet only. e.g. something like:
/drives/{drive-id}/root/children?$filter=file ne null
However, my experience with the Graph explorer suggests that nothing is supported that will allow me to do this.
Can anyone tell me any possible method for doing this? Hopefully using some OData parameters on /drives rather than using sites/(siteId)/lists(listId)/items - if this method were to be used, how then could i filter out Document Sets from the results?

TFS Query: Can I compile a query to produce a list of any WorkItems I modified?

I would like to get a list of any WorkItems I modified in TFS using TFS query builder. Including status changes I made, "assinged to" changes and including those I made posts in History.
That looks to me like pretty basic and logical query, but couldn't fiugre out how to do that.
We're using the TFS web interface, but I guess it's identical to the query builder in VS's Team Explorer.
You can get all the work items you modified with the "Changed By" field (with “Was Ever” = your username):
This query returns all the work items you modified any field (State, Assigned To, etc.), but you can't create a query to get only work items when you changed them only specific fields.

List all files recursively in microsoft graph

We are trying to retrieve all files under a folder recursively, but I can't find an API for that.
I've tried using the search API without a query, but this doesn't return anything.
https://graph.microsoft.com/v1.0/sites/root/drive/root/search(q='{}')
Is this possible in microsoft graph ?
It turns out the correct link is:
https://graph.microsoft.com/v1.0/sites/root/drive/root/search(q='')
Thanks #Marc LaFleur
2021 edit: this api unfortunately doesn't return all the files. So I ended up using the sharepoint delta api to sync sharepoint data locally, then I use a mysql query to find all files of a given folder (there is a child <-> parent relation in the files/folder metadata return from the API)
If you want to find all of the files recursively of a SharePoint Document Library (which is still a Drive), you can apply a filter on the Content type not being a Folder. for example:
https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?$expand=fields,driveItem&$filter=fields/ContentType eq 'Document'
This will return all of the Documents (i.e.: anything not a folder) recursively. Since the driveItem is being expanded, you will have all of the DriveItem details needed.
I am able to list all items with this below :
{drive-root-id} is the /Drive/root "id" value return from :
https://graph.microsoft.com/v1.0/{site-id}/drive/root
Then :
https://graph.microsoft.com/v1.0/{site-id}/drive/items/{drive-root-id}/children

Retrieve the WIQL of a saved query created in TFS

I have created a query in TFS interactively using the web interface. Now I want to get the WIQL that it is using.
The only way I know how is to call the RESTful api, and pass $expand=wiql. Is there an easier way? Ideally from the interactive web interface?
You can use Chrome's "Developer Tools" (under "More Tools") click the Network tab and run the TFS query. You'll see the query item in the list of items. Click on the query item and you'll see the WIQL code in the view pane.
Example:
Doesn't seem like you can do it in the Web Access. You can however do it in Visual Studio (if you have it).
Open the Query and then Edit it, now if you do File, Save as... you can then save the query as a .wiq XML file, that will include the WIQL:
Example content:
<?xml version="1.0" encoding="utf-8"?>
<WorkItemQuery Version="1">
<TeamFoundationServer>https://----.visualstudio.com/defaultcollection</TeamFoundationServer>
<TeamProject>Test Agile</TeamProject>
<Wiql>SELECT [System.WorkItemType], [System.Title], [System.State],
[Microsoft.VSTS.Scheduling.StoryPoints], [System.IterationPath], [System.Tags]
FROM WorkItemLinks
WHERE Source.[System.WorkItemType] in group 'Microsoft.RequirementCategory'
</WorkItemQuery>

Volusion API - Export Orders by Date Range

On a scheduled basis, I would like to export Volusion orders by a date range:
select * from orders o where o.OrderDate >= '7/20/2015' AND o.OrderDate <= '7/23/2015'
Is this possible? It appears my URL can only do an equals sign:
https://www.XX.net/net/WebService.aspx?Login=shopxperts#yahoo.com&EncryptedPassword=XX&EDI_Name=Generic\Orders&SELECT_Columns=*&WHERE_Column=o.orderdate&WHERE_Value=7/18/2015 10:58:09 AM
I looked at the SQL saved query feature. Is there a way to save a query with parameters, then fill them in?
Yes you can insert parameters into the query and execute it from the Generic folder.
Using a custom ASP page, this is a summary of what you would have to do
1- Read the querystring(s) and sanitizing them.
2- Construct the SQL query with sanitized parameters
3- Write the SQL and XSD files to the "Generic" folder
4- execute the now written file in the generic folder by making a http request
https://www.XX.net/net/WebService.aspx?Login=shopxperts#yahoo.com&EncryptedPassword=XX&EDI_Name=Generic\xyz
5- Delete the files since it's no longer needed once the query is complete.
6- Return data from the query to the page requesting the data
Obviously, this is an very abridged version of what you would need to do but it is certainly possible.

Resources