I faced an issue while creating a SharePoint sub site using a custom site template with message “The field specified with name _AuthorByline and ID {1a7348e7-1bb7-4a47-9790-088e7cb20b58} is not accessible or does not exist”.
So, this column was referenced by some lists/content types from the web site from which custom site template was created.
Solution 1
Find the list or libraries in which the field is added/referenced,
- Write this custom code in console app, to loop through all the lists and then loop through all fields from these lists.
- While looping add a check if the field’s display name or internal name is the one for which you are getting error.
- string _accessToken = TokenHelper.GetAppOnlyAccessToken(TokenHelper.SharePointPrincipal, tenantUrl.Authority, TokenHelper.GetRealmFromTargetUrl(tenantUrl)).AccessToken;
- using(var context = TokenHelper.GetClientContextWithAccessToken(projectReady, _accessToken)) {
- Web w = context.Web;
- context.Load(w.Lists);
- context.ExecuteQuery();
- FieldCollection fields = null;
- foreach(List list in w.Lists) {
- fields = list.Fields;
- context.Load(fields);
- context.ExecuteQuery();
- foreach(Field field in fields) {
- if (field.Title == "_AuthorByline" || field.InternalName == "_AuthorByline") {
- Console.WriteLine("Got it");
- Console.ReadLine();
- }
- }
- }
- context.Load(w.ContentTypes);
- context.ExecuteQuery();
- foreach(ContentType ct in w.ContentTypes) {
- context.Load(ct.Fields);
- context.ExecuteQuery();
- foreach(Field field in ct.Fields) {
- if (field.Title == "_AuthorByline" || field.InternalName == "_AuthorByline") {
- Console.WriteLine("Got it");
- Console.ReadLine();
- }
- }
- }
- }
Solution 2
If you still get an issue, follow the below steps,
- Download the template wsp file from SharePoint and rename the extension from wsp to cab.
- Open the cab file and select all and copy all the files to a folder.
- Open this folder in Visual Studio. I opened the folder in Visual Studio Code.
- Press Ctrl + Shift + F to find the text in all the files in the folder and type the column name for which you are getting error.
- You should be able to find the references in the files. In my case I had issues in content types “Site Page” and “Repost Page”.
- So, I removed the content types and added it again in the Site Pages library as there were no pages using these content types.
- Then saving the template again resolved the issue.