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

I have issues with updating stringcollection type #70

Open
GangadharMFord opened this issue Nov 9, 2024 · 1 comment
Open

I have issues with updating stringcollection type #70

GangadharMFord opened this issue Nov 9, 2024 · 1 comment
Labels
question Further information is requested

Comments

@GangadharMFord
Copy link

GangadharMFord commented Nov 9, 2024

Hi, I'm using PowerShell script to create and update my custom Microsoft Search graph connector. And I'm having issues while updating string collection value type. And getting Schme malformed error message.

In schema defined as:
@{
name = "tags"
type = "StringCollection"
isQueryable = "true"
isSearchable = "true"
isRetrievable = "true"
}
@{
name = "categories"
type = "StringCollection"
isQueryable = "true"
isSearchable = "true"
isRetrievable = "true"
}
And in PowerShell script, with $item value :
$categoryPaths = if ($.categoryPaths -eq $null) { @() } else { @($.categoryPaths | ForEach-Object { $_.fullPath }) }
$categoryPathsFormatted = '["' + ($categoryPaths -join '","') + '"]'

    $tags = if ($_.tags -eq $null) { @() } else { @($_.tags) }
    $tagsFormatted = '["' + ($tags -join '","') + '"]'    

$item = @{
        id = $index
        properties = @{
            '[email protected]'    = 'Collection(String)'  
            categories                 = $categoryPathsFormatted 
             
            '[email protected]'          = 'Collection(String)'
            tags                       = $tagsFormatted     
        }
        content = @{
            value = $_.title
            type  = 'text'
        }
        acl = @(
            @{
                accessType = "grant"
                type       = "user"
                value      = "<<GUID>>"
            }
        )
        activities = @(@{
            "@odata.type" = "#microsoft.graph.externalConnectors.externalActivity"
            type          = "created"
            startDateTime = "2024-09-25T07:10:46.261Z"
            performedBy   = @{
                type = "user"
                id   = $externalConnection.userId
            }
        })
    }

Still getting error and my input values for Categeries and tags are in below format:
tags : {EnterpriseSearch, Search, Enterprise Search, Testing}
categoryPaths : {@{categoryId=e918e06f-8400-44fc-922b-XXXXXXX; name=Testing+; fullPath=Testing+; restricted=False},
@{categoryId=7dfd8441-bbc0-4497-a3fc-XXXXXXXX; name=Test Category; fullPath=Test Category; restricted=False}}

And Getting the error is:
Set-MgExternalConnectionItem_Set:
Line |
66 | Set-MgExternalConnectionItem -ExternalConnectionId $exter …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The request is malformed or incorrect.

Status: 400 (BadRequest)
ErrorCode: InvalidRequest
Date: 2024-11-09T15:16:36

Body:
{
"error": {
"code": "InvalidRequest",
"message": "The request is malformed or incorrect.",
"innerError": {
"code": "DeserializationError",
"message": "One or more errors occurred. (One or more errors occurred. (A property 'categories' which only has property annotations in the payload but no property value is an open property. In OData, open property must be represented as a property with value.))",
"date": "2024-11-09T15:16:36",
"request-id": "ad78d5ef-ca2b-4ecd-b347-29d495685653",
"client-request-id": "3cdd722e-afd2-4aa0-8578-bc89b9400eeb"
}
}
}
Any help or suggestions please?

@waldekmastykarz
Copy link
Member

Have you looked at how the request that's actually going over the wire looks like? It could help you understand what's wrong.

@waldekmastykarz waldekmastykarz added the question Further information is requested label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants