[CSOM]System.FormatException: 'Not well formatted JSON stream.'

场景:
遍历site collection里面的是所有site,对site中的指定content type类型的页面的属性做一些修改。在取属性值的时候就会报错,System.FormatException: ‘Not well formatted JSON stream.’。奇怪的点是:一个一个subsite去跑的时候,并没有报错。但是遍历site collection下面的subsite的时候就会报错。下面是截图:
在这里插入图片描述

解决方法:
后来发现是取i => i.ContentType.Fields得时候有问题,对于sharepoint中的属性,我们可以根据属性名直接取,但是直接i => i.ContentType.Fields去获得会有点问题。去掉i => i.ContentType.Fields之后就正常了。

获取属性的方法:
item[“属性名”]

猜你喜欢

转载自blog.csdn.net/WendyXu8230/article/details/88393226