Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaces deprecated methods #6244

Closed
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/AuthServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class AuthServer {
};

private httpListener = async (): Promise<void> => {
const requestState = Math.random().toString(16).substr(2, 20);
const requestState = Math.random().toString(16).substring(2, 20);
MartinM85 marked this conversation as resolved.
Show resolved Hide resolved
const address = this.httpServer.address() as AddressInfo;
this.generatedServerUrl = `http://localhost:${address.port}`;
const url = `${Auth.getEndpointForResource('https://login.microsoftonline.com', this.connection.cloudType)}/${this.connection.tenant}/oauth2/authorize?response_type=code&client_id=${this.connection.appId}&redirect_uri=${this.generatedServerUrl}&state=${requestState}&resource=${this.resource}&prompt=select_account`;
Expand Down
2 changes: 1 addition & 1 deletion src/Command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ export default abstract class Command {
pos = pos1;
}

commandName = commandName.substr(0, pos).trim();
commandName = commandName.substring(0, pos).trim();
}

return commandName;
Expand Down
4 changes: 2 additions & 2 deletions src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ function printAvailableCommands(): void {
commandsToPrint[commandName] = command;
}
else {
const subCommandsGroup: string = commandName.substr(0, pos);
const subCommandsGroup: string = commandName.substring(0, pos);
if (!commandGroupsToPrint[subCommandsGroup]) {
commandGroupsToPrint[subCommandsGroup] = 0;
}
Expand Down Expand Up @@ -1034,7 +1034,7 @@ function loadOptionValuesFromFiles(args: { options: yargs.Arguments }): void {
return;
}

const filePath: string = value.substr(1);
const filePath: string = value.substring(1);
// if the file doesn't exist, leave as-is, if it exists replace with
// contents from the file
if (fs.existsSync(filePath)) {
Expand Down
2 changes: 1 addition & 1 deletion src/m365/entra/commands/m365group/m365group-add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ class EntraM365GroupAddCommand extends GraphCommand {
}

private getImageContentType(imagePath: string): string {
const extension: string = imagePath.substr(imagePath.lastIndexOf('.')).toLowerCase();
const extension: string = imagePath.substring(imagePath.lastIndexOf('.')).toLowerCase();

switch (extension) {
case '.png':
Expand Down
2 changes: 1 addition & 1 deletion src/m365/entra/commands/m365group/m365group-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class EntraM365GroupGetCommand extends GraphCommand {
};

const res = await request.get<{ webUrl: string }>(requestOptions);
group.siteUrl = res.webUrl ? res.webUrl.substr(0, res.webUrl.lastIndexOf('/')) : '';
group.siteUrl = res.webUrl ? res.webUrl.substring(0, res.webUrl.lastIndexOf('/')) : '';
}

await logger.log(group);
Expand Down
2 changes: 1 addition & 1 deletion src/m365/entra/commands/m365group/m365group-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class EntraM365GroupListCommand extends GraphCommand {
const res = await request.get<{ webUrl: string }>(requestOptions);
return {
id: groupId,
url: res.webUrl ? res.webUrl.substr(0, res.webUrl.lastIndexOf('/')) : ''
url: res.webUrl ? res.webUrl.substring(0, res.webUrl.lastIndexOf('/')) : ''
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/m365/entra/commands/m365group/m365group-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class EntraM365GroupSetCommand extends GraphCommand {
}

private getImageContentType(imagePath: string): string {
const extension: string = imagePath.substr(imagePath.lastIndexOf('.')).toLowerCase();
const extension: string = imagePath.substring(imagePath.lastIndexOf('.')).toLowerCase();

switch (extension) {
case '.png':
Expand Down
7 changes: 3 additions & 4 deletions src/m365/file/commands/convert/convert-pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { AxiosResponse } from 'axios';
import fs from 'fs';
import os from 'os';
import path from 'path';
import url from 'url';
import { v4 } from 'uuid';
import auth from '../../../../Auth.js';
import { Logger } from '../../../../cli/Logger.js';
Expand Down Expand Up @@ -243,13 +242,13 @@ class FileConvertPdfCommand extends GraphCommand {
return fileGraphUrl;
}

const _url = url.parse(fileWebUrl);
const _url = new URL(fileWebUrl);
let siteId: string = '';
let driveRelativeFileUrl: string = '';
const siteInfo = await this.getGraphSiteInfoFromFullUrl(_url.host as string, _url.path as string);
const siteInfo = await this.getGraphSiteInfoFromFullUrl(_url.hostname, _url.pathname);

siteId = siteInfo.id;
let siteRelativeFileUrl: string = (_url.path as string).replace(siteInfo.serverRelativeUrl, '');
let siteRelativeFileUrl: string = _url.pathname.replace(siteInfo.serverRelativeUrl, '');
// normalize site-relative URLs for root site collections and root sites
if (!siteRelativeFileUrl.startsWith('/')) {
siteRelativeFileUrl = '/' + siteRelativeFileUrl;
Expand Down
11 changes: 5 additions & 6 deletions src/m365/file/commands/file-add.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import fs from 'fs';
import path from 'path';
import url from 'url';
import { Logger } from '../../../cli/Logger.js';
import GlobalOptions from '../../../GlobalOptions.js';
import request, { CliRequestOptions } from '../../../request.js';
Expand Down Expand Up @@ -73,7 +72,7 @@ class FileAddCommand extends GraphCommand {
public async commandAction(logger: Logger, args: CommandArgs): Promise<void> {
let folderUrlWithoutTrailingSlash = args.options.folderUrl;
if (folderUrlWithoutTrailingSlash.endsWith('/')) {
folderUrlWithoutTrailingSlash = folderUrlWithoutTrailingSlash.substr(0, folderUrlWithoutTrailingSlash.length - 1);
folderUrlWithoutTrailingSlash = folderUrlWithoutTrailingSlash.substring(0, folderUrlWithoutTrailingSlash.length - 1);
}

try {
Expand Down Expand Up @@ -148,15 +147,15 @@ class FileAddCommand extends GraphCommand {
await logger.logToStderr(`Resolving Graph drive item URL for ${fileWebUrl}`);
}

const _fileWebUrl = url.parse(fileWebUrl);
const _siteUrl = url.parse(siteUrl || fileWebUrl);
const _fileWebUrl = new URL(fileWebUrl);
const _siteUrl = new URL(siteUrl || fileWebUrl);
const isSiteUrl = typeof siteUrl !== 'undefined';
let siteId: string = '';
let driveRelativeFileUrl: string = '';
const siteInfo = await this.getGraphSiteInfoFromFullUrl(_siteUrl.host as string, _siteUrl.path as string, isSiteUrl);
const siteInfo = await this.getGraphSiteInfoFromFullUrl(_siteUrl.host, _siteUrl.pathname, isSiteUrl);

siteId = siteInfo.id;
let siteRelativeFileUrl: string = (_fileWebUrl.path as string).replace(siteInfo.serverRelativeUrl, '');
let siteRelativeFileUrl: string = _fileWebUrl.pathname.replace(siteInfo.serverRelativeUrl, '');
// normalize site-relative URLs for root site collections and root sites

if (!siteRelativeFileUrl.startsWith('/')) {
Expand Down
2 changes: 1 addition & 1 deletion src/m365/spfx/commands/package/package-generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ class SpfxPackageGenerateCommand extends AnonymousCommand {
}

private static getWebPartAlias(webPartName: string): string {
return 'AutoWP' + webPartName.replace(/[^a-zA-Z0-9]/g, '').substr(0, 40);
return 'AutoWP' + webPartName.replace(/[^a-zA-Z0-9]/g, '').substring(0, 40);
}

private static generateNewId = (): string => {
Expand Down
4 changes: 2 additions & 2 deletions src/m365/spfx/commands/project/JsonRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ export abstract class JsonRule extends Rule {
isArray = true;
const pos = currentProperty.indexOf('[') + 1;
// get array element from the property name
arrayElement = currentProperty.substr(pos, currentProperty.length - pos - 1);
arrayElement = currentProperty.substring(pos, currentProperty.length - 1);
// remove array element from the property name
currentProperty = currentProperty.substr(0, pos - 1);
currentProperty = currentProperty.substring(0, pos - 1);
}

for (let i = 0; i < node.children.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export class FN016004_TS_property_pane_property_import extends TsRule {

obj.forEach(n => {
const resource: string = n.getText();
const importsText: string = resource.replace(/\s/g, '').substr(resource.indexOf('{'));
const imports: string[] = importsText.substr(0, importsText.indexOf('}')).split(',');
const importsText: string = resource.replace(/\s/g, '').substring(resource.indexOf('{'));
const imports: string[] = importsText.substring(0, importsText.indexOf('}')).split(',');
const importsToStay: string[] = [];
const importsToBeMoved: string[] = [];

Expand Down
2 changes: 1 addition & 1 deletion src/m365/spfx/commands/spfx-doctor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ class SpfxDoctorCommand extends BaseProjectCommand {
}

private getNodeVersion(): string {
return process.version.substr(1);
return process.version.substring(1);
}

private async checkStatus(what: string, versionFound: string, versionCheck: VersionCheck): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion src/m365/spo/commands/file/file-add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ class SpoFileAddCommand extends SpoCommand {
const isLastChunk: boolean = info.Position >= info.Size;
if (isLastChunk) {
// trim buffer for last chunk
fileBuffer = fileBuffer.slice(0, readCount);
fileBuffer = fileBuffer.subarray(0, readCount);
}

const requestOptions: CliRequestOptions = {
Expand Down
3 changes: 1 addition & 2 deletions src/m365/spo/commands/file/file-retentionlabel-ensure.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as url from 'url';
import { Logger } from '../../../../cli/Logger.js';
import GlobalOptions from '../../../../GlobalOptions.js';
import request, { CliRequestOptions } from '../../../../request.js';
Expand Down Expand Up @@ -100,7 +99,7 @@ class SpoFileRetentionLabelEnsureCommand extends SpoCommand {
public async commandAction(logger: Logger, args: CommandArgs): Promise<void> {
try {
const fileProperties = await this.getFileProperties(logger, args);
const parsedUrl = url.parse(args.options.webUrl);
const parsedUrl = new URL(args.options.webUrl);
const tenantUrl: string = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
const listAbsoluteUrl = urlUtil.urlCombine(tenantUrl, fileProperties.listServerRelativeUrl);

Expand Down
3 changes: 1 addition & 2 deletions src/m365/spo/commands/file/file-retentionlabel-remove.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as url from 'url';
import { cli } from '../../../../cli/cli.js';
import { Logger } from '../../../../cli/Logger.js';
import GlobalOptions from '../../../../GlobalOptions.js';
Expand Down Expand Up @@ -111,7 +110,7 @@ class SpoFileRetentionLabelRemoveCommand extends SpoCommand {
private async removeFileRetentionLabel(logger: Logger, args: CommandArgs): Promise<void> {
try {
const fileProperties = await this.getFileProperties(logger, args);
const parsedUrl = url.parse(args.options.webUrl);
const parsedUrl = new URL(args.options.webUrl);
const tenantUrl: string = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
const listAbsoluteUrl = urlUtil.urlCombine(tenantUrl, fileProperties.listServerRelativeUrl);

Expand Down
3 changes: 1 addition & 2 deletions src/m365/spo/commands/folder/folder-retentionlabel-ensure.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as url from 'url';
import GlobalOptions from '../../../../GlobalOptions.js';
import { Logger } from '../../../../cli/Logger.js';
import request, { CliRequestOptions } from '../../../../request.js';
Expand Down Expand Up @@ -97,7 +96,7 @@ class SpoFolderRetentionLabelEnsureCommand extends SpoCommand {
const folderProperties = await this.getFolderProperties(logger, args);

if (folderProperties.ListItemAllFields) {
const parsedUrl = url.parse(args.options.webUrl);
const parsedUrl = new URL(args.options.webUrl);
const tenantUrl: string = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
const listAbsoluteUrl = urlUtil.urlCombine(tenantUrl, folderProperties.ListItemAllFields.ParentList.RootFolder.ServerRelativeUrl);

Expand Down
3 changes: 1 addition & 2 deletions src/m365/spo/commands/folder/folder-retentionlabel-remove.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as url from 'url';
import GlobalOptions from '../../../../GlobalOptions.js';
import { cli } from '../../../../cli/cli.js';
import { Logger } from '../../../../cli/Logger.js';
Expand Down Expand Up @@ -113,7 +112,7 @@ class SpoFolderRetentionLabelRemoveCommand extends SpoCommand {
const folderProperties = await this.getFolderProperties(logger, args);

if (folderProperties.ListItemAllFields) {
const parsedUrl = url.parse(args.options.webUrl);
const parsedUrl = new URL(args.options.webUrl);
const tenantUrl: string = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
const listAbsoluteUrl = urlUtil.urlCombine(tenantUrl, folderProperties.ListItemAllFields.ParentList.RootFolder.ServerRelativeUrl);

Expand Down
2 changes: 1 addition & 1 deletion src/m365/spo/commands/list/list-webhook-add.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ describe(commands.LIST_WEBHOOK_ADD, () => {
const currentDate: Date = new Date();
currentDate.setMonth(currentDate.getMonth() + 4);
currentDate.setDate(1);
const dateString: string = currentDate.toISOString().substr(0, 10);
const dateString: string = currentDate.toISOString().substring(0, 10);

const actual = await command.validate({
options:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as url from 'url';
import { Logger } from '../../../../cli/Logger.js';
import GlobalOptions from '../../../../GlobalOptions.js';
import request, { CliRequestOptions } from '../../../../request.js';
Expand Down Expand Up @@ -161,7 +160,7 @@ class SpoListItemRetentionLabelEnsureCommand extends SpoCommand {
}

private async getListAbsoluteUrl(options: Options, logger: Logger): Promise<string> {
const parsedUrl = url.parse(options.webUrl);
const parsedUrl = new URL(options.webUrl);
const tenantUrl: string = `${parsedUrl.protocol}//${parsedUrl.hostname}`;

if (options.listUrl) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as url from 'url';
import { cli } from '../../../../cli/cli.js';
import { Logger } from '../../../../cli/Logger.js';
import GlobalOptions from '../../../../GlobalOptions.js';
Expand Down Expand Up @@ -127,7 +126,7 @@ class SpoListItemRetentionLabelRemoveCommand extends SpoCommand {
}

private async getListAbsoluteUrl(options: Options, logger: Logger): Promise<string> {
const parsedUrl = url.parse(options.webUrl);
const parsedUrl = new URL(options.webUrl);
const tenantUrl: string = `${parsedUrl.protocol}//${parsedUrl.hostname}`;

if (options.listUrl) {
Expand Down
2 changes: 1 addition & 1 deletion src/m365/spo/commands/page/page-add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class SpoPageAddCommand extends SpoCommand {
let bannerImageUrl: string = '';
let canvasContent1: string = '';
let layoutWebpartsContent: string = '';
const pageTitle: string = args.options.title ? args.options.title : (args.options.name.indexOf('.aspx') > -1 ? args.options.name.substr(0, args.options.name.indexOf('.aspx')) : args.options.name);
const pageTitle: string = args.options.title ? args.options.title : (args.options.name.indexOf('.aspx') > -1 ? args.options.name.substring(0, args.options.name.indexOf('.aspx')) : args.options.name);
let pageId: number | null = null;
const pageDescription: string = args.options.description || "";

Expand Down
2 changes: 1 addition & 1 deletion src/m365/spo/commands/site/site-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ class SpoSiteSetCommand extends SpoCommand {
headers: {
'X-RequestDigest': this.context.FormDigestValue
},
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions>${payload.join('')}<ObjectPath Id="14" ObjectPathId="13" /><ObjectIdentityQuery Id="15" ObjectPathId="5" /><Query Id="16" ObjectPathId="13"><Query SelectAllProperties="false"><Properties><Property Name="IsComplete" ScalarProperty="true" /><Property Name="PollingInterval" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Identity Id="5" Name="53d8499e-d0d2-5000-cb83-9ade5be42ca4|${(this.tenantId as string).substr(pos, (this.tenantId as string).indexOf('&') - pos)}&#xA;SiteProperties&#xA;${formatting.encodeQueryParameter(args.options.url)}" /><Method Id="13" ParentId="5" Name="Update" /></ObjectPaths></Request>`
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions>${payload.join('')}<ObjectPath Id="14" ObjectPathId="13" /><ObjectIdentityQuery Id="15" ObjectPathId="5" /><Query Id="16" ObjectPathId="13"><Query SelectAllProperties="false"><Properties><Property Name="IsComplete" ScalarProperty="true" /><Property Name="PollingInterval" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Identity Id="5" Name="53d8499e-d0d2-5000-cb83-9ade5be42ca4|${(this.tenantId as string).substring(pos, (this.tenantId as string).indexOf('&'))}&#xA;SiteProperties&#xA;${formatting.encodeQueryParameter(args.options.url)}" /><Method Id="13" ParentId="5" Name="Update" /></ObjectPaths></Request>`
};

response = await request.post<string>(requestOptions);
Expand Down
2 changes: 1 addition & 1 deletion src/m365/teams/commands/user/user-app-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class TeamsUserAppListCommand extends GraphCommand {
const items = await odata.getAllItems<TeamsAppInstallation>(endpoint);
items.forEach(i => {
const userAppId: string = Buffer.from(i.id as string, 'base64').toString('ascii');
const appId: string = userAppId.substr(userAppId.indexOf("##") + 2, userAppId.length - userId.length - 2);
const appId: string = userAppId.substring(userAppId.indexOf("##") + 2, userAppId.length);
(i as any).appId = appId;
});

Expand Down
3 changes: 2 additions & 1 deletion src/m365/todo/commands/list/list-remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { cli } from '../../../../cli/cli.js';
import { Logger } from '../../../../cli/Logger.js';
import GlobalOptions from '../../../../GlobalOptions.js';
import request from '../../../../request.js';
import { formatting } from '../../../../utils/formatting.js';
import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
import commands from '../../commands.js';

Expand Down Expand Up @@ -79,7 +80,7 @@ class TodoListRemoveCommand extends DelegatedGraphCommand {
}

const requestOptions: any = {
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${escape(args.options.name!)}'`,
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${formatting.encodeQueryParameter(args.options.name!)}'`,
headers: {
accept: "application/json;odata.metadata=none"
},
Expand Down
3 changes: 2 additions & 1 deletion src/m365/todo/commands/list/list-set.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Logger } from '../../../../cli/Logger.js';
import GlobalOptions from '../../../../GlobalOptions.js';
import request from '../../../../request.js';
import { formatting } from '../../../../utils/formatting.js';
import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
import commands from '../../commands.js';

Expand Down Expand Up @@ -95,7 +96,7 @@ class TodoListSetCommand extends DelegatedGraphCommand {
}

const requestOptions: any = {
url: `${endpoint}/me/todo/lists?$filter=displayName eq '${escape(args.options.name as string)}'`,
url: `${endpoint}/me/todo/lists?$filter=displayName eq '${formatting.encodeQueryParameter(args.options.name!)}'`,
headers: {
accept: "application/json;odata.metadata=none"
},
Expand Down
3 changes: 2 additions & 1 deletion src/m365/todo/commands/task/task-add.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Logger } from '../../../../cli/Logger.js';
import GlobalOptions from '../../../../GlobalOptions.js';
import request, { CliRequestOptions } from '../../../../request.js';
import { formatting } from '../../../../utils/formatting.js';
import { validation } from '../../../../utils/validation.js';
import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
import commands from '../../commands.js';
Expand Down Expand Up @@ -206,7 +207,7 @@ class TodoTaskAddCommand extends DelegatedGraphCommand {
}

const requestOptions: any = {
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${escape(args.options.listName as string)}'`,
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${formatting.encodeQueryParameter(args.options.listName!)}'`,
headers: {
accept: 'application/json;odata.metadata=none'
},
Expand Down
3 changes: 2 additions & 1 deletion src/m365/todo/commands/task/task-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { cli } from '../../../../cli/cli.js';
import { Logger } from '../../../../cli/Logger.js';
import GlobalOptions from '../../../../GlobalOptions.js';
import request, { CliRequestOptions } from '../../../../request.js';
import { formatting } from '../../../../utils/formatting.js';
import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
import commands from '../../commands.js';
import { ToDoTask } from '../../ToDoTask.js';
Expand Down Expand Up @@ -70,7 +71,7 @@ class TodoTaskGetCommand extends DelegatedGraphCommand {
}

const requestOptions: CliRequestOptions = {
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${escape(args.options.listName as string)}'`,
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${formatting.encodeQueryParameter(args.options.listName!)}'`,
headers: {
accept: 'application/json;odata.metadata=none'
},
Expand Down
Loading