Searching for Teams Items in Organization Backups

In this article

    You can search for Microsoft Teams items in backups of a Microsoft 365 organization.

    Request

    POST https://<hostname>:4443/v6/RestoreSessions/{restoreSessionId}/organization/searchTeams

    Request Headers

    The request header must contain an authorization token of the current session.

    Request Parameters

    The following parameter must be specified in the URL of the request:

    Parameter

    Type

    Description

    restoreSessionId

    string

    Specifies the identification number of the restore session. For more information on how to get this parameter, see Getting Restore Sessions.

    Request Body

    The request body must contain the following properties:

    Property

    Type

    Description

    type

    string

    Specifies the type of Microsoft Teams items that you want to find. The following types are available:

    • Files
    • Posts
    • Tabs

    query

    string

    Specifies query parameters used to search for Microsoft Teams items. For more information, see Query Parameters.

    Query Parameters

    The following table lists examples of parameters that you can use in the query string to search for Microsoft Teams items in backups of a Microsoft 365 organization.

    For the complete list of supported query parameters, see Appendix A. Item Search Parameters.

    Search Parameters for Files

    Parameter

    Type

    Description

    author

    string

    Specifies the name of the user who created the file.

    Query example: author:admin.

    created

    string

    Specifies the time when the file was created.

    Query example: created:this year.

    modified

    string

    Specifies the time of the latest modification of the post.

    Query example: modified:this year.

    ext

    string

    Specifies the file extension.

    Query example: ext:html.

    filename

    string

    Specifies the file name or part of the file name.

    Query example: filename:report.

    size

    string

    Specifies the file size.

    Query example: size:5MB.

    Search Parameters for Posts

    Parameter

    Type

    Description

    author

    string

    Specifies the name of the user who created the post.

    Query example: author:admin.

    created

    string

    Specifies the time when the post was created.

    Query example: created:this year.

    modified

    string

    Specifies the time of the latest modification of the post.

    Query example: modified:this year.

    hasattachments

    string

    Defines whether the post has attachments.

    Query example: hasattachments:true.

    body

    string

    Specifies the part of the post message body.

    Query example: body:important.

    subject

    string

    Specifies the post subject or part of the post subject.

    Query example: subject:announcement.

    Search Parameters for Tabs

    Parameter

    Type

    Description

    name

    string

    Specifies the name of the tab.

    Query example: name:website.

    Request Example 1

    Request:

    POST https://abc.tech.local:4443/v6/RestoreSessions/0748598d-19fa-4c05-a999-71722decdfb3/organization/searchTeams

     

    Request Header:

    Authorization: Bearer <Access-Token>

     

    Request Body:

    {
       "type": "Files",

       "query": "filename:report"

    }

    Request Example 2

    Request:

    POST https://abc.tech.local:4443/v6/RestoreSessions/0748598d-19fa-4c05-a999-71722decdfb3/organization/searchTeams

     

    Request Header:

    Authorization: Bearer <Access-Token>

     

    Request Body:

    {
       "type": "Posts",

       "query": "subject:announcement"

    }

    Request Example 3

    Request:

    POST https://abc.tech.local:4443/v6/RestoreSessions/0748598d-19fa-4c05-a999-71722decdfb3/organization/searchTeams

     

    Request Header:

    Authorization: Bearer <Access-Token>

     

    Request Body:

    {
       "type": "Tabs",

       "query": "name:website"

    }

    Response

    The server returns the following response to the client.

    Response Codes

    A successfully completed operation returns a response code 200 OK.

    Response Headers

    The response to this request contains the following headers. The response may also include additional standard HTTPS headers.

    Header

    Description

    Content-length

    The length of the response body.

    Content-type

    The media type and syntax of the response body message: application/json; charset=utf-8

    Response Body

    The response body contains the following properties:

    Property

    Type

    Description

    results

    Results Object

    Contains the Results object.

    _links

    Dictionary of string [key] and Object [value]

    Links to related resources (navigation property).

    Results Object

    Results Object for Files

    Property

    Type

    Description

    id

    string

    Specifies the file ID.

    name

    string

    Specifies the file name.

    sizeBytes

    integer

    Specifies the file size.

    version

    integer

    Specifies a version of the file in the backup.

    modified

    UTC

    Specifies the date and time of the last modification of the file.

    modifiedBy

    string

    Specifies a name of the user who performed the latest modification of the file.

    fileType

    string

    Specifies the Microsoft Teams item type. The following types are available:

    • File
    • Folder

    _links

    Dictionary of string [key] and Object [value]

    Links to related resources (navigation property).

    Results Object for Posts

    Property

    Type

    Description

    postId

    integer

    Specifies the post ID.

    isImportant

    boolean

    Defines whether the post is marked as important.

    author

    string

    Specifies the user name of the author of the post.

    subject

    string

    Specifies the post subject.

    createdTime

    UTC

    Specifies the date and time when the post was created.

    lastModifiedTime

    UTC

    Specifies the date and time of the last modification of the post.

    attachments

    attachment

    Specifies attachment items of the post.

    _links

    Dictionary of string [key] and Object [value]

    Links to related resources (navigation property).

    attachment

    Property

    Type

    Description

    name

    string

    Specifies a name of the attachment item.

    longFileName

    string

    Specifies a name of the attachment file.

    url

    string

    Specifies the URL address of the attachment item.

    Results Object for Tabs

    Property

    Type

    Description

    id

    string

    Specifies the backed-up tab ID.

    displayName

    string

    Specifies the backed-up tab display name.

    contentUrl

    string

    Specifies the URL address of the object published on the backed-up tab.

    type

    string

    Specifies the backed-up tab type.

    _links

    Dictionary of string [key] and Object [value]

    Links to related resources (navigation property).

    Response Example

    Response:

    200 OK

     

    Response Body:

    {

     "offset": 0,

     "limit": 30,

     "_links": {

       "self": {

         "href": "/v6/RestoreSessions/0748598d-19fa-4c05-a999-71722decdfb3/organization/searchTeams?offset=0&limit=30"

       }

     },

     "results": [

       {

         "id": "22b8a172-7dec-46a4-9bc2-c6693c246648",

         "name": "Posts_14-06-2021_11-50-39.html",

         "sizeBytes": 453685,

         "version": 4,

         "modified": "2021-08-19T08:26:53Z",

         "modifiedBy": "admin1",

         "fileType": "File",

         "_links": {

           "self": {

             "href": "v6/restoresessions/0748598d-19fa-4c05-a999-71722decdfb3/organization/teams/09473396-3da0-428a-951c-cb55a164f556/files/22b8a172-7dec-46a4-9bc2-c6693c246648?channelId=19:5e4c971fc6d34ec0a93d800de5dfe331@thread.tacv2"

           },

           "channel": {

             "href": "v6/restoresessions/0748598d-19fa-4c05-a999-71722decdfb3/organization/teams/09473396-3da0-428a-951c-cb55a164f556/channels/19:5e4c971fc6d34ec0a93d800de5dfe331@thread.tacv2"

           },

           "team": {

             "href": "v6/restoresessions/0748598d-19fa-4c05-a999-71722decdfb3/organization/teams/09473396-3da0-428a-951c-cb55a164f556"

           }

         }

       },

       {

         "id": "20d1f161-2c26-4372-bdf2-dcfee92743b3",

         "name": "Posts_16-02-2022_15-25-04.html",

         "sizeBytes": 455211,

         "version": 2,

         "modified": "2022-02-14T12:24:49Z",

         "modifiedBy": "admin2",

         "fileType": "File",

         "_links": {

           "self": {

             "href": "v6/restoresessions/0748598d-19fa-4c05-a999-71722decdfb3/organization/teams/09473396-3da0-428a-951c-cb55a164f556/files/20d1f161-2c26-4372-bdf2-dcfee92743b3?channelId=19:5e4c971fc6d34ec0a93d800de5dfe331@thread.tacv2"

           },

           "channel": {

             "href": "v6/restoresessions/0748598d-19fa-4c05-a999-71722decdfb3/organization/teams/09473396-3da0-428a-951c-cb55a164f556/channels/19:5e4c971fc6d34ec0a93d800de5dfe331@thread.tacv2"

           },

           "team": {

             "href": "v6/restoresessions/0748598d-19fa-4c05-a999-71722decdfb3/organization/teams/09473396-3da0-428a-951c-cb55a164f556"

           }

         }

       },

    ...

    ],

     "setId": "00000000-0000-0000-0000-000000000000"

    }