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

Getting error while Creating new list item #237

Closed
shavas23 opened this issue Jul 31, 2020 · 2 comments
Closed

Getting error while Creating new list item #237

shavas23 opened this issue Jul 31, 2020 · 2 comments
Labels

Comments

@shavas23
Copy link

Hi Team,

I am trying to create a new List Item in share point list called "Test1"

am i did any mistake here? could you please help me to fix it.

Thanks for you support in advance

Python script:

Sp_list = ctx.web.lists.get_by_title("Test1")
itemcreateInfo = {'Title':'5657849301','Dummy1':'6543210987','Dummy2':'50','Dummy3':'Open'}
new_it = Sp_list.add_item(itemcreateInfo)
# new_it.update()
# ctx.load(new_it)
ctx.execute_query()

getting following error :

raise ClientRequestException(*e.args, response=e.response)
office365.runtime.client_request_exception.ClientRequestException: ('-1, Microsoft.SharePoint.Client.InvalidClientQueryException', 'The parameter Dummy1 does not exist in method GetByTitle.', "400 Client Error: Bad Request for url:

@vgrem vgrem added the question label Jul 31, 2020
@dfish88
Copy link

dfish88 commented Jul 31, 2020

I think you will need to load the list first before adding to it:

Sp_list = ctx.web.lists.get_by_title("Test1")
ctx.load(Sp_list)
ctx.execute_query()
itemcreateInfo = {'Title':'5657849301','Dummy1':'6543210987','Dummy2':'50','Dummy3':'Open'}
new_it = Sp_list.add_item(itemcreateInfo)
ctx.execute_query()

@shavas23
Copy link
Author

shavas23 commented Aug 1, 2020

Thank you so much dfish88 now scripts working perfectly again than thank for the support.
such a great library thank you and much appreciated vgrem and dfish88

@shavas23 shavas23 closed this as completed Aug 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants