outlook-mcp
Version:
Comprehensive MCP server for Claude to access Microsoft Outlook and Teams via Microsoft Graph API - including Email, Calendar, Contacts, Tasks, Teams, Chats, and Online Meetings
41 lines (33 loc) • 1.03 kB
JavaScript
/**
* OData helper functions for Microsoft Graph API
*/
/**
* Escapes a string for use in OData queries
* @param {string} str - The string to escape
* @returns {string} - The escaped string
*/
function escapeODataString(str) {
if (!str) return str;
// Replace single quotes with double single quotes (OData escaping)
// And remove any special characters that could cause OData syntax errors
str = str.replace(/'/g, "''");
// Escape other potentially problematic characters
str = str.replace(/[\(\)\{\}\[\]\:\;\,\/\?\&\=\+\*\%\$\#\@\!\^]/g, '');
console.error(`Escaped OData string: '${str}'`);
return str;
}
/**
* Builds an OData filter from filter conditions
* @param {Array<string>} conditions - Array of filter conditions
* @returns {string} - Combined OData filter expression
*/
function buildODataFilter(conditions) {
if (!conditions || conditions.length === 0) {
return '';
}
return conditions.join(' and ');
}
module.exports = {
escapeODataString,
buildODataFilter
};