Hi Team,
I have the below code which sends a file attached to an incident in SCSM to Service-Now. I need some help in sending multiple files attached to an incident in SCSM to SNOW. I have the files downloaded in the local repository with the folder name same as the incident (Eg. IR1234). Also, one of the header (content-type) is dynamically changing based on the file type. For example the equivalent MIME type can be as given in the link https://developer.devada.com/docs/mime-types
`$CRED=get-credential
$URI="https://service-now.com/api/now/attachment/file?table_name=incident&table_sys_id=65fad8e21bf5b010d6557805464bcbe9&file_name=Sample.txt"
$headers=New-Object "System.Collections.Generic.Dictionary[[String], [String]]"
#$headers.Add('Authorization',('Basic {0}' -f $base64AuthInfo))
$headers.Add("Content-Type", 'text/plain')
$headers.Add("Accept", 'application/json')
# Specifiy file to attach
$fileToAttach = "C:\Users\jankrish1\Desktop\New_folder\Sample.txt"
# Specify HTTP method (POST, PATCH, PUT)
$method = "POST"
# Send HTTP request
$response = Invoke-WebRequest -Headers $headers -Method $method -credential $CRED -Uri $URI -Infile $fileToAttach
# Print response
$response.RawContent
Any help is greatly appreciated!!!
Regards,
Jansi