Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions packages/office-addin-dev-settings/src/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,22 @@ export async function uninstallWithTeams(id: string): Promise<boolean> {
return new Promise((resolve, reject) => {
const guidRegex = /[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/;
const manifestIdRegex = new RegExp(`^${guidRegex.source}$`);
const titleIdRegex = new RegExp(`^U_${guidRegex.source}$`);
const titleIdRegex = new RegExp(`^.+_(${guidRegex.source})$`);
let mode: string = "";
let uninstallId: string = id;
Comment thread
archiesaxenaa marked this conversation as resolved.

if (titleIdRegex.test(id)) {
mode = `--mode title-id --title-id ${id}`;
} else if (manifestIdRegex.test(id)) {
if (manifestIdRegex.test(id)) {
mode = `--mode manifest-id --manifest-id ${id}`;
} else {
Comment thread
archiesaxenaa marked this conversation as resolved.
Outdated
console.error(`Error: Invalid id "${id}". Add-in is still installed.`);
resolve(false);
return;
const match = id.match(titleIdRegex);
if (match) {
uninstallId = match[1];
mode = `--mode manifest-id --manifest-id ${uninstallId}`;
} else {
console.error(`Error: Invalid id "${id}". Add-in is still installed.`);
resolve(false);
return;
}
}

const uninstallCommand = `npx -p @microsoft/m365agentstoolkit-cli atk uninstall ${mode} --interactive false`;
Expand Down