0

Using CSOM for SharePoint Online Site Collection, able to create lists, edit lists items, add list items, etc. Just can not figure out how to either delete the 'Title' field or just remove it from the default view. At least got it to not be required. Found a few examples with Google but none worked. Any sample code or link to good source. Following is one of the versions attempted. We're stuck using VB Net (corporate direction) but C# sample would help too.

Side question; we currently using CSOM within VB Net to interact with SP on the client side, what are opinions on using PowerShell or PnP or maybe REST API instead? We are permitted to use other languages if the're interpreted languages. Any advantages of any over others? Are any outdated per se?

        Using clientContext As New Microsoft.SharePoint.Client.ClientContext(siteUrl)
            clientContext.Credentials = credentials
            Dim oWebsite As Microsoft.SharePoint.Client.Web = clientContext.Web
            Dim oList As Microsoft.SharePoint.Client.List = oWebsite.GetListByTitle(listName)
            Dim oView As Microsoft.SharePoint.Client.View = oList.DefaultView
            clientContext.Load(oView, Function(vw) vw.ViewFields)
            Dim ofield As Microsoft.SharePoint.Client.Field = oList.Fields.GetByInternalNameOrTitle("Title")
            Dim ofieldNumber As Microsoft.SharePoint.Client.FieldNumber = clientContext.CastTo(Of Microsoft.SharePoint.Client.FieldNumber)(ofield)
            clientContext.Load(ofieldNumber)
            clientContext.ExecuteQuery()
            oView.ViewFields.Remove("Title")
            oView.Update()
            clientContext.ExecuteQuery()
        End Using

Thank you in advance for any responses.

1 Answer 1

1

given the answer, use LinkTitle instead of Title...

oView.ViewFields.Remove("LinkTitle")
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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