teams
This class establishes the JDITO connection to send various Microsoft Graph API requests from the designer
Methods
addApp
addApp(
pTeamId,pAppId):void
Adds an app to a team
Works with an application token Requires this permission: Group.ReadWrite.All
Parameters
string | number | booleanthe TeamId to which the application should be assigned
string | number | booleanthe AppId, the App which should be assigned to the team (To be found in TeamsAdminCenter, provided the App has been provided for the organization)
Returns
voidThrows
AditoException
addExternalMembers
addExternalMembers(
pTeamId,pExternalUsers):Map<any,any>
Adds any number of new external members to the transferred team
Works with an application token Requires these permissions: Group.ReadWrite.All and Directory.ReadWrite.All
Parameters
string | number | booleanThe TeamId to which the members are to be added
Returns
Map<any, any>the failed Ids; null if all successful
Throws
AditoException
addInternalMembers
addInternalMembers(
pTeamId,pInternalUsers):Map<any,any>
Adds any number of new internal members to the team
Works with an application token Requires one of these permissions: Group.ReadWrite.All, Directory.ReadWrite.All
Parameters
string | number | booleanThe TeamId to which the members are to be added
Returns
Map<any, any>the failed Ids; null if all successful
Throws
AditoException
archiveTeam
archiveTeam(
pTeamId):void
Archive the team and delete the Azure group
INFO: When Office 365 groups are deleted, they are moved to a temporary container and can be restored within 30 days. After this period they are permanently deleted Archive team before deleting group, because bug in teams leads to the team still being available
Works with an application token Requires one of these permissions: Group.ReadWrite.All, Directory.ReadWrite.All (archive + delete)
Parameters
string | number | booleanthe TeamId of the team to be deleted or archived
Returns
voidThrows
AditoException
changeRole
changeRole(
pTeamId,pUserConfig):void
Changes the role of a team member. If the team member is an owner, he is removed from the owners. If he is only a member, he will be added to the Owners
Works with an application token Requires one of these permissions: Group.ReadWrite.All, Directory.ReadWrite.All
Parameters
string | number | booleanthe TeamId in which the member is a member
Returns
voidThrows
AditoException
createChannel
createChannel(
pChannelConfig):void
Creates a new channel in a specific team
Works with an application token Requires one of these permissions: Group.ReadWrite.All, Directory.ReadWrite.All
Parameters
Returns
voidThrows
AditoException
createChannelConfig
createChannelConfig(
pTeamId,pDisplayName):ChannelConfig
Create and return a config object for GraphAPI calls to create channels
Parameters
string | number | booleanstring | number | booleanReturns
ChannelConfig
createExternalUserConfig
createExternalUserConfig(
pEmail):ExternalUserConfig
Create and return a config object for GraphAPI calls to add external members
Parameters
string | number | booleanReturns
ExternalUserConfig
createGroupConfig
createGroupConfig(
pDisplayName,pMailNickName,pOwnerIds):GroupConfig
Create and return a config object for GraphAPi calls to create teams
Parameters
string | number | booleanstring | number | booleanstring[]Returns
GroupConfig
createInternalUserConfig
createInternalUserConfig(
pAzureUserId):InternalUserConfig
Create and return a config object for GraphAPI calls to add internal members
Parameters
string | number | booleanReturns
InternalUserConfig
createTeam
createTeam(
pGroupConfig,pTeamConfig):Map<any,any>
Creates a new Azure Active Directory group, adds its owner and creates a MicrosoftTeams team
Works with an application token Requires this permission: Group.ReadWrite.All
Parameters
Returns
Map<any, any>the Id, DisplayName, GeneralChannelId and WebUrl of the created team in a ScriptableMap
Throws
AditoException
createTeamConfig
createTeamConfig():
TeamConfig
Create and return a config object for GraphAPI calls to create teams
Returns
TeamConfig
getAllArchivedTeams
getAllArchivedTeams(
pSearchValue):Map<any,any>
Lists all archived teams
INFO: Through the GraphAPI you can not call specific resources in Java and a call without specific resource is not allowed => CustomRequest
Works with an application token Requires one of these permissions: Group.Read.All, Directory.Read.All, Group.ReadWrite.All, Directory.ReadWrite.All
Without search term, this query returns up to 100 results The search term starts only from the beginning of the string: 'B' returns only teams with the initial letter 'B...'.
Parameters
string | number | booleana search term after all teams are filtered; can be null
Returns
Map<any, any>The Id's and DisplayNames of all archived teams
Throws
AditoException
getAllChannels
getAllChannels(
pTeamId,pSearchValue):Map<any,any>
Delivers all channels from one team
Works with an application token Requires one of these permissions: Group.Read.All, Group.ReadWrite.All, Directory.Read.All, Directory.ReadWrite.All
INFO: Without search term, this query may return more than 100 results The search term starts only from the beginning of the string: 'B' returns only channels with the initial letter 'B...'.
Parameters
string | number | booleanthe TeamId of which team, the channels are to be delivered
string | number | booleana search term by which all channels are filtered; can be null
Returns
Map<any, any>a ScriptableMap with Id and names of the channels
Throws
AditoException
getAllDocuments
getAllDocuments(
pTeamId,pChannelName):any
Delivers all documents of the handed over team and handed over channels have been sent.
INFO: The permissions "Group.ReadWrite.All" and "Group.Create" do not seem to be compatible. You have to remove "Group.Create" for this to work => bug in GraphAPI.
Works with an application token Requires one of these permissions: Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All
Parameters
string | number | booleanThe TeamId from which the documents are to be retrieved
string | number | booleanthe name of the channel from which the files should be retrieved; Channel Name = Sharepoint Folder Name
Returns
anyA RhinoObject, that all documents of the passed channel are stored in a JsonArray construct with relevant data
Throws
AditoException
getAllMembers
getAllMembers(
pTeamId):Map<any,any>
Returns all members from a given team
Works with an application token Requires one of these permissions: GroupMember.Read.All, Group.Read.All, GroupMember.ReadWrite.All, Group.ReadWrite.All, Directory.Read.All
Parameters
string | number | booleanthe TeamId from which the members are to be returned
Returns
Map<any, any>a ScriptableMap with Id(key) and displayName(value) from all members of the team
Throws
AditoException
getAllOwners
getAllOwners(
pTeamId):Map<any,any>
Returns all owners from a handed over team
Works with an application token Requires one of these permissions: Group.Read.All, Group.ReadWrite.All, Directory.Read.All, Directory.AccessAsUser.All
Parameters
string | number | booleanthe TeamId from which the members are to be returned
Returns
Map<any, any>a ScriptableMap with Id(key) and displayName(value) from all members of the team
Throws
AditoException
getAllTeams
getAllTeams(
pSearchValue):Map<any,any>
Returns all groups that also have a team in MicrosoftTeams.
INFO: For this you need a $filter query. The filter "resourceProvisioningOptions" is so far only available with the beta endpoint => CustomRequest No permissions on MSDocs here; it is assumed that it works with an application token and the permission Group.Read.All Without search term, this query returns up to 100 results The search term starts only from the beginning of the string: 'B' returns only teams with the initial letter 'B...'.
Works with an application token Requires one of these permissions: Group.Read.All, Directory.Read.All, Group.ReadWrite.All, Directory.ReadWrite.All
Parameters
string | number | booleana search term after all teams are filtered; can be null
Returns
Map<any, any>a ScriptableMap with Id's(key) and DisplayNames(value) from all teams
Throws
AditoException
getAnswerForMessageId
getAnswerForMessageId(
pTeamId,pChannelId,pMessageId):any
Returns the answers for a given id of a message.
INFO: This request is currently in beta! => Works only with CustomRequest Protected API => User-Token
Works with a user token Requires this permission: ChannelMessage.Read.All
Example:
Parameters
string | number | booleanThe TeamId in which the channel is located, whose messages are retrieved
string | number | booleanThe ChannelId from which the message was retrieved
string | number | booleanThe id of the message, we want to load the answers
Returns
anyA RhinoObject with all answers
Throws
AditoException
Example
import { teams, logging } from "@aditosoftware/jdito-types";
var teamsId = "18c204da-4632-4840-8096-ee8dc765cae9";
var channelId = "19:_mEqssJ0Q9me5CiRoXwbgVCbMGpTk4-837HfNPYFRpc1@thread.tacv2";
var messageId = "1676983133368";
var answers = teams.getAnswerForMessageId(teamsId, channelId, messageId);
logging.log(JSON.stringify(answers));
getChannelMessages
getChannelMessages(
pTeamId,pChannelId,pAmount):any
Returns the channel messages of a handed over channel, without answers, as Json Array
INFO: This request is currently in beta! => Works only with CustomRequest Protected API => User-Token
Works with a user token Requires this permission: ChannelMessage.Read.All
Only Plain Text Messages will be loaded
See getChannelMessages(String pTeamId, String pChannelId, int pAmount, boolean pIncludeFormattedMessages)
Parameters
string | number | booleanThe TeamId in which the channel is located, whose messages are retrieved
string | number | booleanThe ChannelId from which the messages are retrieved
numberThe number of messages that are retrieved - defaultValue=20
Returns
anyA RhinoObject with a link for the next messages and with all messages, with relevant data from the passed channel
Deprecated
This API is deprecated.
Throws
AditoException
getChannelMessages(
pTeamId,pChannelId,pAmount,pIncludeFormattedMessages):any
Returns the channel messages of a handed over channel, without answers, as Json Array
INFO: This request is currently in beta! => Works only with CustomRequest Protected API => User-Token
Works with a user token Requires this permission: ChannelMessage.Read.All
Only Plain Text Messages will be loaded
See getChannelMessages(String pTeamId, String pChannelId, int pAmount, boolean pIncludeFormattedMessages)
Parameters
string | number | booleanThe TeamId in which the channel is located, whose messages are retrieved
string | number | booleanThe ChannelId from which the messages are retrieved
numberThe number of messages that are retrieved - defaultValue=20
undefinedInclude Messages with HTML content, otherwise only TEXT
Returns
anyA RhinoObject with a link for the next messages and with all messages, with relevant data from the passed channel
Deprecated
This API is deprecated.
Throws
AditoException
getChannelMessages(
pTeamId,pChannelId,pAmount,pIncludeFormattedMessages):any
Returns the channel messages of a handed over channel, without answers, as Json Array
INFO: This request is currently in beta! => Works only with CustomRequest Protected API => User-Token
Works with a user token Requires this permission: ChannelMessage.Read.All
Parameters
string | number | booleanThe TeamId in which the channel is located, whose messages are retrieved
string | number | booleanThe ChannelId from which the messages are retrieved
numberThe number of messages that are retrieved - defaultValue=20
booleanInclude Messages with HTML content, otherwise only TEXT
Returns
anyA RhinoObject with a link for the next messages and with all messages, with relevant data from the passed channel
Throws
AditoException
getGeneralChannelId
getGeneralChannelId(
pTeamId):string
Supplies from a team the Id of the general channel
Works with an application token Requires one of these permissions: Group.Read.All, Group.ReadWrite.All, Directory.Read.All, Directory.ReadWrite.All
Parameters
string | number | booleanthe TeamId from which the id of the general channel should be delivered
Returns
stringThe id of the general channel
Throws
AditoException
getInternalAzureId
getInternalAzureId(
pUserUpn):string
Returns the Azure user ID of the passed UserUPN
Works with an application token Requires one of these permissions: User.Read.All, User.ReadWrite.All, Directory.Read.All, Directory.ReadWrite.All
Parameters
string | number | booleanthe UserPrincipableName of the user
Returns
stringthe AzureId as string
Throws
AditoException
getNextChannelMessages
getNextChannelMessages(
pNextLinkUrl,pAmount):any
Delivers the next messages
INFO: Top Parameter is already contained in the pURL, it is used by the previous query, but is still needed
Works with a user token Requires this permission: ChannelMessage.Read.All
Only Plain Text Messages will be loaded
See getNextChannelMessages(String pNextLinkUrl, int pAmount, boolean pIncludeFormattedMessages)
Parameters
string | number | booleanthe Url to retrieve the next messages; is obtained from the function getChannelMessages in the response
numberThe number of messages that are retrieved - defaultValue=20
Returns
anyA RhinoObject with a link for the next messages and with all further messages, with relevant data
Deprecated
This API is deprecated.
Throws
AditoException
getNextChannelMessages(
pNextLinkUrl,pAmount,pIncludeFormattedMessages):any
Delivers the next messages
INFO: Top Parameter is already contained in the pURL, it is used by the previous query, but is still needed
Works with a user token Requires this permission: ChannelMessage.Read.All
Only Plain Text Messages will be loaded
See getNextChannelMessages(String pNextLinkUrl, int pAmount, boolean pIncludeFormattedMessages)
Parameters
string | number | booleanthe Url to retrieve the next messages; is obtained from the function getChannelMessages in the response
numberThe number of messages that are retrieved - defaultValue=20
undefinedInclude Messages with HTML content, otherwise only TEXT
Returns
anyA RhinoObject with a link for the next messages and with all further messages, with relevant data
Deprecated
This API is deprecated.
Throws
AditoException
getNextChannelMessages(
pNextLinkUrl,pAmount,pIncludeFormattedMessages):any
Delivers the next messages
INFO: Top Parameter is already contained in the pURL, it is used by the previous query, but is still needed
Works with a user token Requires this permission: ChannelMessage.Read.All
Parameters
string | number | booleanthe Url to retrieve the next messages; is obtained from the function getChannelMessages in the response
numberThe number of messages that are retrieved - defaultValue=20
booleanInclude Messages with HTML content, otherwise only TEXT
Returns
anyA RhinoObject with a link for the next messages and with all further messages, with relevant data
Throws
AditoException
getPresence
getPresence(
pUserObjectId):any
Returns a users presence/status. Use getInternalAzureId to get the objectId for a users upn
Works with a user token Requires one of these permissions: Presence.Read.All, Presence.ReadWrite.All
Parameters
string | number | booleanThe users object id
Returns
anyA json object with nodes id, availability, activity
Throws
AditoException
getPresences
getPresences(
pUserObjectIds):any
Returns presence/status for a list of users. Use getInternalAzureId to get the objectId for a users upn
Works with a user token Requires one of these permissions: Presence.Read.All, Presence.ReadWrite.All
Parameters
string[]The users object ids as array
Returns
anyA json object in which the node "value" contains an array whose nodes contain id, availability, activity or null if the parameter is empty
Throws
AditoException
getWebUrl
getWebUrl(
pTeamId):string
Delivers the WebUrl of a team.
Works with an application token Requires one of these permissions: Group.Read.All, Directory.Read.All, Group.ReadWrite.All, Directory.ReadWrite.All
Parameters
string | number | booleanthe TeamId from which the WebUrl is to be retrieved
Returns
stringthe WebUrl as string
Throws
AditoException
removeExternalMembers
removeExternalMembers(
pTeamId,pExternalUsers):Map<any,any>
Removes external members from the transferred team
Works with an application token Requires one of these permissions: Group.ReadWrite.All, Directory.ReadWrite.All
Parameters
string | number | booleanthe TeamId from which the members should be removed
Returns
Map<any, any>the failed Ids; null if all successful
Throws
AditoException
removeInternalMembers
removeInternalMembers(
pTeamId,pInternalUsers):Map<any,any>
Removes internal members from the transferred team
Works with an application token Requires one of these permissions: Group.ReadWrite.All, Directory.ReadWrite.All
Parameters
string | number | booleanthe TeamId from which the members should be removed
Returns
Map<any, any>the failed Ids; null if all successful
Throws
AditoException
sendAnswerToBotRequest
sendAnswerToBotRequest(
pMessage,pRecipientId,pRecipientName,pServiceUrl,pConversationId,pMessageId):void
Sends a response to the BotRequest.
Parameters
string | number | booleanThe message to be sent as reply
string | number | booleanThe id of the recipient of the message
string | number | booleanThe name of the recipient of the message
string | number | booleanThe ServiceUrl; This is what you get in the request that comes in
string | number | booleanThe ConversationId of this conversation is also given in the request
string | number | booleanThe id of the message to which you want to reply
Returns
voidThrows
AditoException
sendNotification
sendNotification(
pServiceUrl,pChannelId,pMessage):void
Sends a notification/message on behalf of the bot to the General Channel
INFO: ChannelId = ConversationId For this notification you need a Bot-OAuth2 token. You can't get it from GraphAPI or ScribeJava => Normal HttpRequest to the Botframework token endpoint
Parameters
string | number | booleanThe ServiceUrl that was used for the initial request (to be found in the DB)
string | number | booleanthe ChannelId of the channel to which you want to send
string | number | booleanThe message/notification to be sent
Returns
voidThrows
AditoException
sendNotificationAsCard
sendNotificationAsCard(
pServiceUrl,pChannelId,pMessage,pUser,pUrlToProject):void
Sends a notification/message as a card on behalf of the bot to the General Channel
INFO: ChannelId = ConversationId For this notification you need a Bot-OAuth2 token. You can't get it from GraphAPI or ScribeJava => Normal HttpRequest to the Botframework token endpoint
Parameters
string | number | booleanThe ServiceUrl that was used for the initial request (to be found in the DB)
string | number | booleanthe ChannelId of the channel to which you want to send
string | number | booleanThe message/notification to be sent
string | number | booleanThe user who have changed something
string | number | booleanThe url to the project itself
Returns
voidThrows
AditoException
unarchiveTeam
unarchiveTeam(
pTeamId):void
Restores a team and the Azure group This only works for 30 days from the time the team is deleted. After that it is automatically deleted for good
INFO: The team remains in the "hidden teams
Works with an application token Requires one of these permissions: Group.ReadWrite.All, Directory.ReadWrite.all (unarchive + restore)
Parameters
string | number | booleanthe TeamId of the team to be restored
Returns
voidThrows
AditoException