Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

KeyError: 'Title' #55

Open
vicbruno opened this issue Sep 27, 2019 · 6 comments · May be fixed by #109
Open

KeyError: 'Title' #55

vicbruno opened this issue Sep 27, 2019 · 6 comments · May be fixed by #109

Comments

@vicbruno
Copy link

I encountered a Sharepoint list where the 'Title' field has been deleted or renamed. Looks like Shareplum always expects it to be there.

C:\ProgramData\Anaconda3\lib\site-packages\shareplum\shareplum.py in init(self, session, listName, url, verify_ssl, users, huge_tree, timeout)

         self._disp_cols = {i['DisplayName']: {'name': i['Name'], 'type': i['Type']} for i in self.fields}
 
         title_col = self._sp_cols['Title']['name']
         title_type = self._sp_cols['Title']['type']
         self._disp_cols[title_col] = {'name': 'Title', 'type': title_type}
@jasonrollins
Copy link
Owner

I assume it's always there because I'm under the impression that it can't be deleted, just renamed. What version of Sharepoint are you using and how did you delete the 'Title' column?

@vicbruno
Copy link
Author

I also assumed it wasn't possible, but I find myself querying such a list. Sharepoint Server 2016.

I un-commented the code you had right right below the lines above to get past that.

        standard_source = 'http://schemas.microsoft.com/sharepoint/v3'
        self._sp_cols = {i['Name']: {'name': i['DisplayName'], 'type': i['Type']} for i in self.fields}
        self._disp_cols = {i['DisplayName']: {'name': i['Name'], 'type': i['Type']} for i in self.fields \
                        if i['StaticName'] in ['Title', 'Modified'] or i['SourceID'] != standard_source}

@FerrumFatum
Copy link

I am seeing a similar issue, but with u'Title'. The workaround above does not solve the issue in my case.

File "C:\Python27\lib\site-packages\shareplum\shareplum.py", line 303, in List return _List(self._session, listName, self._url, self._verify_ssl, self.users, self.huge_tree, self.timeout) File "C:\Python27\lib\site-packages\shareplum\shareplum.py", line 337, in __init__ title_col = self._sp_cols['Title']['name'] KeyError: u'Title'

@jasonrollins
Copy link
Owner

I'm closing this issue as it relates to SharePoint 2016 and adding it to SharePlum2.

logan-pugh added a commit to logan-pugh/shareplum that referenced this issue Jun 16, 2020
@logan-pugh logan-pugh linked a pull request Jun 16, 2020 that will close this issue
@logan-pugh
Copy link

I'm also seeing this with Sharepoint Online. Simple fix is in #109

When the Title column is referenced in fields by an alias, a KeyError occurs:

    207             # Convert to SharePoint Style Column Names
    208             for i, val in enumerate(fields):
--> 209                 fields[i] = self._disp_cols[val]["name"]
    210             viewfields = fields
    211             soap_request.add_view_fields(fields)

KeyError: 'Title'

@logan-pugh
Copy link

Seems it may apply to other fields with aliases as well, not just Title.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants