有效的ClientContext Web列表GetByTitle返回Null [英] Valid ClientContext Web Lists GetByTitle returns Null
问题描述
您好,我是SharePoint开发的新手,它试图从页面中获取信息.我已经在VB中找到了一种可行的方法,通过在其他列表中的使用证明了这一点.
Hi, i am relatively new to SharePoint development, and trying to grab information from a page. I already have a working method in VB, proven through usage on other list.
下面是我的代码:
Public Sub getWiki(ctx As ClientContext)
Dim WaterIce As SP.List = ctx.Web.Lists.GetByTitle("Water & Ice WIKI")
Dim camlQuery As New CamlQuery
camlQuery.ViewXml = "<Query><Where><And><Contains><FieldRef Name='FileLeafRef' /><Value Type='File'>home</Value></Contains><IsNotNull><FieldRef Name='WikiField' /></IsNotNull></And></Where></Query>"
Dim collatedListItem As ListItemCollection = WaterIce.GetItems(camlQuery)
ctx.Load(collatedListItem)
ctx.ExecuteQuery()
Dim oListItem As ListItem
For Each oListItem In collatedListItem
htmlString = oListItem.FieldValues("WikiField").ToString()
'MsgBox(htmlString)
If htmlString <> "" Or htmlString IsNot Nothing Then
Exit For
End If
Next
WaterIceInnerDiv.InnerHtml = htmlString
End Sub
我尝试自己调试它,并且错误总是在NullException的以下行出现:
I tried debugging it myself, and the error always hit at the following line with NullException:
htmlString = oListItem.FieldValues("WikiField").ToString()
我尝试使用其他列表名称(例如"Water")的方法,但效果很好.我相信这是由于&符,以及有关如何显示此问题的任何指导?
I tried the method with other list name for example "Water", it is working fine. I believe it is due to the ampersand, any guidance on how I can show the issue?
我也尝试过"Water& amp; amp; Ice WIKI","Water& amp; amp; amp; Ice WIKI"和水%20%20& Ice%20Ice%20WIKI"
I also have tried "Water & Ice WIKI", "Water && Ice WIKI" and "Water%20%20&Ice%20Ice%20WIKI" and error i will get is the page does not exist.
推荐答案
Hi Tan,
Hi Tan,
尝试以下一项是否有效:
Try whether the below one works:
水%20%20Ice%20WIKI(或)水和冰WIKI(水和冰之间的两倍距离)
Water%20%20Ice%20WIKI (or) Water Ice WIKI (double space between water and Ice)
这篇关于有效的ClientContext Web列表GetByTitle返回Null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!