Closed epignosisx closed 4 years ago
Figured out the problem. The extension id is actually a concatenation of publisher id and extension id:
export async function createPolicy(strategy: string, repo: string, source: string, target: string): Promise<void> {
var context = SDK.getExtensionContext();
var token = await SDK.getAccessToken();
var dataService = await SDK.getService<IExtensionDataService>(CommonServiceIds.ExtensionDataService);
//var mng = await dataService.getExtensionDataManager(context.extensionId, token); <-- replaced by line below
var mng = await dataService.getExtensionDataManager(context.extensionId + "." + context.extensionId, token);
var doc = await mng.createDocument("MergePolicies-" + repo, { strategy: strategy, repo: repo, source: source, target: target });
console.log(doc);
}
Couple of years later stumble on the same problem! Thanks for finding this @epignosisx
Heads up - extensionId is repeated twice so when your publisherId and extensionId are different it'll still be broken.
var mng = await dataService.getExtensionDataManager(context.publisherId + "." + context.extensionId, token);
Hi folks. I'm trying to create a document using the Extensions Data API but I keep getting a 404 with the following response:
Here is how my request looks like
Here is the outcome in the Network Tab:
This is how my code looks like:
and I'm making sure to initialize the SDK on page startup:
Finally, I've been following this guide based on the old VSS and adapting it to the new SDK/API packages:
https://docs.microsoft.com/en-us/azure/devops/extend/develop/data-storage?view=azure-devops#create-a-document
Really appreciate your help here, I've run out of troubleshooting ideas.