我需要获取SplistItem.Item的值。有一个新的属性添加了“ShortenedUrl”。问题在于,旧网页不包含此属性,因此每当网站是旧网页时,我都会收到“值不在预期范围内”的错误。如何使用SpListItem.Item检索它之前是否存在属性
有没有办法首先检查项目是否存在?获得该值之前是否有 ?
这是我的代码。
'Set shortened URL
Dim objShortUrl As Object = postItemById.Item("ows_ShortenedUrl")
If objShortUrl IsNot Nothing Then
blogPost.shortURL = objShortUrl
Else
blogPost.shortURL = DBNull.Value
End If
如果“ows_ShortenedUrl”存在,我该怎么办?