2

I am currently trying to migrate a list from one sharepoint to another. I did this a few months ago allready and there it worked not bad. But now I run into problems. The list is a discussion list. I was able to create the new items and update the following fields: 'Body', 'Title', 'Created'. So far this was the same as before. Then i wanted to also adjust the field 'Author' to the respective author of the posting. There i get a client request failed error with the following message:

"Es wurden ungültige Daten zur Aktualisierung des Listeneintrags verwendet. Das Feld, das Sie aktualisieren möchten, ist möglicherweise schreibgeschützt."

translated:

"Invalid data has been supplied to update the list item. The field you wish to update may be read only."

First I assumed the problem would be invalid data for the field, maybe getting it from the old sharepoint using getFieldValuesForEdit returned a different format than expected. So I used an author name I knew worked before (the last time i migrated a discussion list) but still the same error. So I think the Author field might actually be read only. Is this possible? If so, is there a way to change that? Or would I need to have server access (powershell, ...) in order to make this field editable?

Another issue arises when I try to add replies to postings into the list. These replies are also part of the main list (on the same level as the actual discussion entries) but have various fields set that identify their respective parents. I tried updating the list items with the appropriate id from the newly created items in the list but they keep showing up as top level and not as replies to the postings. Is there a way to create an item in a discussion list using JSOM that is a repsonse to an existing item?

If you need any code samples for what ive done please leave a comment, I'll post whatever is possible, right now I'd like to avoid to cram this posting full of code. Thank you in advance.

  • Just to be clear, you are using javascript to update the new values? – Brandon C. Jun 10 '14 at 11:44
  • As for your second question, are you saying that when a reply is created, it doesn't reflect the parent in the field? – Brandon C. Jun 10 '14 at 11:58
  • If i create a reply manually on the sharepoint its correctly shown as a child of the message i replied to. But if i create a new list item for the discussion list using client side javascript code and set the field ParentItemID to the id of the message the posting should be a reply to it still is shown on the top level instead of as a child to the message. – Muepe Jun 10 '14 at 12:43
1

First off, if you are running code to update list items outside of sharepoint, you need to have it run on the sharepoint server. Scripts that access your sharepoint web, grab elements by parsing lists, and updating items, all needs to happen serverside. It currently sounds like, since you are using javascript, that you are attempting to access this data through a client-side script. This might be why you are getting "read-only" errors when trying to write to the data.

  • Hello Brandon C. Thanks for your answer. You are right, i am using client side javascript code to update the list. Interestingly i can update several fields of a list item (like the message, the topic, the time created) from that javascript code. But the author doesnt work anymore. – Muepe Jun 10 '14 at 12:41
  • @Muepe, ahh, I see. Well, I know there is a way to set and remove Read-Only for a field with a C# script. So it is possible to set view permissions per field, but I'm not sure why it would change during your migration. – Brandon C. Jun 10 '14 at 12:47
  • My GUESS would be that when you imported a list, it inherited permissions from it's parent site. You can try to see if the parent site has a read-only Author field. If it does, you can break this inheritance. – Brandon C. Jun 10 '14 at 12:57
0

It's possible to update the Author field with JSOM. I don't know how you do it now, but you just need to set the correct ID as the value, e.g:

listItem.set_item('Author', 9);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.