This project has moved and is read-only. For the latest updates, please go here.

Unauthorized even I am admin

Feb 18, 2013 at 9:57 AM
Even I am admin I get the error
System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at Microsoft.SharePoint.SPGlobal.HandleUnauthorizedAccessException(UnauthorizedAccessException ex)
at Microsoft.SharePoint.Library.SPRequest.GetAllWebsOfSite(String bstrUrl, Object& pvarWebs, Object& pvarWebIds, Object& pvarParentWebs, Object& pvarLangs, Object& pvarTitles, Object& pvarUIVersions, Object& pvarFlags, Object& pvarWebTemplates, Object& pvarConfigurations, Object& pvarMasterUrls, Object& pvarCustomMasterUrls, Object& pvarAppInstanceIds)
at Microsoft.SharePoint.SPSite.SPWebCollectionProvider.GetWebsData(String[]& strNames, String[]& strServiceRelUrls, Guid[]& guidWebIds, Int32[]& nLanguages, String[]& strTitles, String[]& strDescriptions, String[]& strCreationTimes, String[]& strModifiedTimes, Boolean[]& bUserIsWebAdmins, Int32[]& nWebTemplates, Int16[]& nProvisionConfigs, Int16[]& nMeetingCounts, Int32[]& nUIVersions, Int32[]& nFlags, String[]& strMasterUrls, String[]& strCustomMasterUrls, Guid[]& guidAppInstanceIds)
at Microsoft.SharePoint.SPWebCollection.EnsureWebsData()
at Microsoft.SharePoint.SPBaseCollection.GetEnumerator()
at FeatureAdmin.FrmMain.btnFindActivatedFeature_Click(Object sender, EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Any ideas ?
Thank you
Feb 18, 2013 at 3:12 PM
Edited Feb 18, 2013 at 4:14 PM
It's best, I think, to say what version of the program you are using, and what version of SharePoint you are using.

Perhaps you lack permissions on some of the content databases?

What do you mean by "admin" ? (For example, do you mean you are a member of BUILTIN\Administrators on one or more of the web front-ends, or do you mean you are a member of DOMAIN|Administrators in the domain, or do you mean you are a member of the Farm Admins SharePoint group, or something else?)

I have added some exception trapping in the source, that has not made it into a release yet. Can you try compiling from source, and see if if then reports more useful information?
Feb 18, 2013 at 4:14 PM
Edited Feb 18, 2013 at 4:15 PM
I am member of domain admins and farm administrator
This is why I ask, because it's strange
I will try to use the source code
Feb 18, 2013 at 4:28 PM
Using source code in debug mode the errors are treated correct only in log, not throwing an error
It about enumerating webs of personal sites (mysites) of all other users.
And now without throwing any error it gives me No faulty Feature found in the farm.
But on the All features installed in the farm I can see ERROR READING FEATURE
Feb 18, 2013 at 7:15 PM
It's best, I think, to say what version of the program you are using, and what version of SharePoint you are using.
Feb 19, 2013 at 6:15 AM
SharePoint 2013 and 2013 version of Feature Admin Tool
Feb 19, 2013 at 6:48 AM
This seems
Feb 19, 2013 at 6:51 AM

I don't even see the word "READING" in the source code. That seems ... peculiar.

Are you completely sure you have copied and pasted the error message correctly

Also, you didn't respond about the content databases - did you double-check your permissions on them?
Feb 19, 2013 at 1:27 PM
I am sysadmin on SQL
Here are some captures

and clicking on Find Faulty Features in Farm gives
Feb 19, 2013 at 4:18 PM
Hm, I'm sorry, somehow my previous solution search was faulty. I just tried again, and found this (Feature.cs, line 58):
result = String.Format("ERROR READING FEATURE [{0}], Scope: {1}", this._id, this._scope.ToString());
Clearly that is the code being called, but, unfortunately it is at a pretty low-level, so just finding that code doesn't shed much light. I may try an experiment.

I have an idea:

Could you pick one site collection exhibiting the problem -- you said that the source version logs the locations correctly? -- and add your account as an SCA (site collection administrator) to that site collection, and see if that removes the "ERROR READING FEATURE" for that site collection?
Feb 19, 2013 at 7:06 PM
I ran a test on SharePoint 2013 using FeatureAdmin compiled from current source. I removed the feature file of a farm-level feature, and then ran FeatureAdmin and clicked the Find Faulty Feature button. It found it -- it did not log an "ERROR READING FEATURE".

So... perhaps you are not missing the feature xml, but rather have something invalid in yours--is that possible?
Feb 20, 2013 at 1:23 AM
Codewise, my guess is that the broken "Feature" object is getting loaded in FeatureManager.AddFeatures, and that the try/catch there is getting triggered.
Feb 20, 2013 at 3:22 AM
I've added a bit more exception reporting. If you can retry it with the latest source, and see if there is any useful information reported in the new log message?
Feb 20, 2013 at 6:20 AM
Indeed it's missing the xml file
I've installed and then uninstalled SQL Reporting Services in Integrated mode.
For some reason the uninstaller didn't removed the feature but removed all files from Features folder.
Also it didn't removed a dwp file from all site collections and I have to delete it with SPD (but it remains in AllDocs table and it's still present in health analyser as missing setup file error)
I will try today your new code
Feb 20, 2013 at 6:43 AM
The bottom line for your case, however, is that the code eventually calls a remove feature call with the force flag set. This is very probably equivalent to using the force flag with the stsadm calls. So if you already tried stsadm with force, and that failed, then I'm afraid it is not likely that this code will work better.

Note: I am, of course, referring to "stsadm -o deactivatefeature ... -force" and "stsadm -o uninstallfeature ... -force".
Feb 20, 2013 at 6:49 AM
If you have instantiated that web part, then its instantiations will be broken if you don't delete them.

They can be found with a T-SQL select call, if you know the WebPartTypeId of the web part. The WebPartTypeId is a hash formed from the webpart type name and the assembly full name, and it is usually written in the form of a GUID.

Of course, they could also be found by custom code walking every page in the farm, but that can take forever; it is much faster to find them via the select against the database.

Here is a codeplex project with the (simple) code for computing the WebPartTypeId:

Once you have the WebPartTypeId, you can find the instantiated occurrences via a select statement like so, against the appropriate content database:

select d.DirName, d.LeafName, * from WebParts wp join AllDocs d on wp.tp_PageUrlID = d.Id where tp_WebPartTypeId = '99999999-9999-9999-9999-999999999999'
Feb 20, 2013 at 6:51 AM
Or here is a concrete sample, which is searching for Content Editor Web Part instances

Web Part Type Name: Microsoft.SharePoint.WebPartPages.ContentEditorWebPart
Full Assembly Name: Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c
WebPartTypeId: e60f6c95-e86c-4717-2c0d-6d8563c9caf7


SELECT d.DirName, d.LeafName, * from [WSS_Content].[dbo].[WebParts] wp JOIN [WSS_Content].[dbo].[AllDocs] d on wp.tp_PageUrlID = d.Id WHERE tp_WebPartTypeId = 'e60f6c95-e86c-4717-2c0d-6d8563c9caf7'
Feb 20, 2013 at 7:06 AM
That web part was not instantiated. I had some errors with RS and I've uninstalled RS.
I've deleted that dwps (ReportViewer.dwp) and now in AllDocs table on DeleteTransactionId field they have an GUID (not 0x) but I don't know when will be removed
I've tried all deleting jobs but nothing happened.
Anyway the error from enumerating webs from personal site collections still gives me an Unauthorized error even I am dbo on ContentDB.
And about that feature in health analyzer it says "the feature with id=... is referenced in the database Sharepoint_AdminContent.... but is not installed in the current farm".
Thank's for your help
Feb 20, 2013 at 9:13 PM
Hello ssandu,

you might have to have full control for each web, too.
Please try to add a policy to your web application in central administration that grants you full control to the complete web application.
(... or make sure, you have full control in each SPWeb)
Feb 20, 2013 at 9:44 PM
Is your deleted file in the site collection recycle bin?
Feb 21, 2013 at 6:14 AM
Yes it's deleted. I did it first time.
But when I delete from both recycle bins in SQL tables the field DeleteTransactionId gets a new value and stays forever like this.
Anyway, I've deleted all references direct from SQL tables.
But if I am farm administrator why should I need a policy to grant full control to a web app ?
I've made it
Feb 24, 2013 at 10:59 PM
Please try again with release version 2.3 of feature admin.