admin管理员组

文章数量:1022688

I'm trying to use Power Automate to create a Lookup field in a SharePoint document library using the "Send an HTTP request to SharePoint" action. However, I’m encountering the following error:

Action 'Send_an_HTTP_request_to_SharePoint' failed: BadGateway

Here’s the API request I'm using to add the Lookup field:

{
  "Title": "Project Lookup",
  "FieldTypeKind": 7,
  "LookupList": "<List GUID of Reference List>",
  "LookupField": "Title",
  "__metadata": {
    "type": "SP.FieldLookup"
  }
}
  • Verified the List GUID of the reference list.
  • Ensured that the field type for the Lookup is correctly set to 7.
  • Tested the request with a simple text field (which worked fine).

I'm trying to use Power Automate to create a Lookup field in a SharePoint document library using the "Send an HTTP request to SharePoint" action. However, I’m encountering the following error:

Action 'Send_an_HTTP_request_to_SharePoint' failed: BadGateway

Here’s the API request I'm using to add the Lookup field:

{
  "Title": "Project Lookup",
  "FieldTypeKind": 7,
  "LookupList": "<List GUID of Reference List>",
  "LookupField": "Title",
  "__metadata": {
    "type": "SP.FieldLookup"
  }
}
  • Verified the List GUID of the reference list.
  • Ensured that the field type for the Lookup is correctly set to 7.
  • Tested the request with a simple text field (which worked fine).
Share Improve this question asked Nov 19, 2024 at 8:32 AsitAsit 131 silver badge4 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

The body of your Send an HTTP request to SharePoint action is just a little bit off. Here is the JSON body package I used to successfully create a lookup column in a SharePoint document library using Power Automate:

{
  'parameters': {
    '__metadata': {
      'type': 'SP.FieldCreationInformation'
    },
    'FieldTypeKind': 7,
    'Title': '<your column title>',
    'LookupListId': '<your lookup list ID>',
    'LookupFieldName': '<your lookup column name>'
  }
}

You didn't mention what endpoint you were using, but for this example I used _api/web/lists/getbytitle('<your document library title')/fields/addfield

Also, be sure your action's method is set to POST and you have the following headers:

accept: application/json;odata=verbose
content-type: application/json;odata=verbose

Here is a good resource for programmatically creating/getting columns in SharePoint lists using Power Automate.

Please let me know if this works!

I'm trying to use Power Automate to create a Lookup field in a SharePoint document library using the "Send an HTTP request to SharePoint" action. However, I’m encountering the following error:

Action 'Send_an_HTTP_request_to_SharePoint' failed: BadGateway

Here’s the API request I'm using to add the Lookup field:

{
  "Title": "Project Lookup",
  "FieldTypeKind": 7,
  "LookupList": "<List GUID of Reference List>",
  "LookupField": "Title",
  "__metadata": {
    "type": "SP.FieldLookup"
  }
}
  • Verified the List GUID of the reference list.
  • Ensured that the field type for the Lookup is correctly set to 7.
  • Tested the request with a simple text field (which worked fine).

I'm trying to use Power Automate to create a Lookup field in a SharePoint document library using the "Send an HTTP request to SharePoint" action. However, I’m encountering the following error:

Action 'Send_an_HTTP_request_to_SharePoint' failed: BadGateway

Here’s the API request I'm using to add the Lookup field:

{
  "Title": "Project Lookup",
  "FieldTypeKind": 7,
  "LookupList": "<List GUID of Reference List>",
  "LookupField": "Title",
  "__metadata": {
    "type": "SP.FieldLookup"
  }
}
  • Verified the List GUID of the reference list.
  • Ensured that the field type for the Lookup is correctly set to 7.
  • Tested the request with a simple text field (which worked fine).
Share Improve this question asked Nov 19, 2024 at 8:32 AsitAsit 131 silver badge4 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

The body of your Send an HTTP request to SharePoint action is just a little bit off. Here is the JSON body package I used to successfully create a lookup column in a SharePoint document library using Power Automate:

{
  'parameters': {
    '__metadata': {
      'type': 'SP.FieldCreationInformation'
    },
    'FieldTypeKind': 7,
    'Title': '<your column title>',
    'LookupListId': '<your lookup list ID>',
    'LookupFieldName': '<your lookup column name>'
  }
}

You didn't mention what endpoint you were using, but for this example I used _api/web/lists/getbytitle('<your document library title')/fields/addfield

Also, be sure your action's method is set to POST and you have the following headers:

accept: application/json;odata=verbose
content-type: application/json;odata=verbose

Here is a good resource for programmatically creating/getting columns in SharePoint lists using Power Automate.

Please let me know if this works!

本文标签: