.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

EventHandler Firing only for administrator users

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :SharePoint


I have wrote an event handler which is working very good.

Today I finally tested it using a non administrator user and the event handler is just not firing (it ignore the code).


My code start like this:

public override void ItemAdding(SPItemEventProperties properties)

            StreamWriter sw = File.CreateText("c:\\splog.txt");
            sw.WriteLine("Code Ran");
            SPSite spSite = new SPSite("http://sharepoint");
            SPWeb web = spSite.OpenWeb("/");



When I use an administrator account I can see the file created and got no problem, when I use a non administrator account the code is just not running.

Thank you very much for any help.

View Complete Post

More Related Resource Links

EventReceiver does not fire for other users than Administrator


Hi all

My code adds a EventReceiver to some SPLists. When I log into Sharepoint as Administrator, then the EventReciever is fired.

When i log in as an other user, it does nothing.


My current code is this:

string assm = "Minimizer, Version=" + FileVersionInfo.GetVersionInfo(Root.Res.DLL).FileVersion + ", Culture=neutral, PublicKeyToken=d2d19387a15c363f";
          string cls = "MinimizerPlugin.Minimizer";
          l.EventReceivers.Add(SPEventReceiverType.ItemUpdated, assm, cls);
          l.EventReceivers.Add(SPEventReceiverType.ItemAdded, assm, cls);

What can I do to register this EventReceiver to all users?

Thanks for your help!!

Take site offline for all users except administrator

Is it possible to take site offline for all users, but give admins ability to use and edit it? Maybe something like app_offline.htm, but not for all users. Thanks a lot.

Users (even site collection administrator) unable to see minor versions in document libraries


I have document libraries with the following settings: major & minor versioning enabled, checkout required & 'only users who can edit items' can see draft (minor) items. The problem is when a user uploads a document (the first document), the library appears empty. However, looking at the summary in 'view all site content' we see that the number of items in the list has incremented by 1. Typically, if the user selects explorer view they can also see the document they just uploaded.

Similar behaviour occurs using the 'New document' option. Before checking in the document for this first time it is visible in the library. If it is checked in as v 0.1 it 'disappears' if it is checked in as v 1.0 it is visible.

I have noticed that if I toggle the Draft Item Security setting by setting it to 'any user who can read items' then set it back immediately to 'only users who can edit items' that the previously hidden items become visible. And any new minor versions created subsequently are also displayed correctly. I can of course do this for existing libraries, but if new libraries are created based on my template this behaviour reoccurs.

Has anyone seen this before?

Search doesn't work for standard users, but work for Administrator


I'm new to SharePoint.

I have a Sharepoint site running on WSS 3.0. We use separate accounts to run the SharePoint sites and for the search.

The search doesn't work properly. I have did some test and here is the result

1. Using a regular user acocunt / Initiate Search from Site Home Page

Search returns the results for some search queries and not for others. for Eg: When I search for "Team" I get a result. When I search for "Management" I get the result. But when I search for "Release" or 'Release Management" I get the below error.

Your search cannot be completed because of a service error. Try your search again or contact your administrator for more information.

2.Using a regular user acocunt / Initiate Search from Search Page of the site (<<sitename>>_layouts/searchresults.aspx)

When I search for words that do retun a result, I get result. When I search for "Release" which I knwo doesn't return any result, I get the same error as above.

Your search cannot be completed because of a service error. Try your search again or contact your administrator for more information.

This where it gets interesting. Now, after I get the above error, when I search for known w

MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

Enabling Users to Maintain SharePoint Content

When SharePoint is installed as a corporate intranet, there is a considerable amount of effort involved in maintaining the content to keep the site relevant. As we discussed in the first few parts of this series, SharePoint has many built-in features to reduce the burden on the site administrator.

Some areas of the site usually contain less-dynamic information. Internal memos and corporate policies are common examples of this information. One option for this information is to post these documents in a document library. Documents in a library are often stored in a few different formats: Word, Acrobat (PDF), or HTML. Each of these formats has its drawbacks.

Enabling Users to Maintain SharePoint Content

When SharePoint is installed as a corporate intranet, there is a considerable amount of effort involved in maintaining the content to keep the site relevant. As we discussed in the first few parts of this series, SharePoint has many built-in features to reduce the burden on the site administrator.

Need help redirecting users to personalized page


 Hi, first timer here so be gentle.


I've been able to create a cool little website, it's up and running with users logging in and out, I created roles so my administrative team can see sensitive data that's not available to regular and anonymous users.

Now they would like me to create a page specific to each user.  For instance when user A logs in they are redirected to a page that has information that pertains to user A only (like a list of their benefits/ their remaining vacation time). This page needs to be accessible only to user A. 

I've watched a ton of the videos but have yet to see one that covers this topic, any help would be great!!!





Intranet Users Challenged When Using Windows Integrated Security


We've setup an intranet site using Windows Integrated Security. Its up and running and users can access it. However, they are being challenged with a login dialog for the server when they initially access the site.

Isn't is possible to configure the server so that the users aren't challenged AND are recognized as being already authenticated by Windows? We're trying to go with a seamless experience, whereby all they have to do is login to their machine like normal and then go from there.

Users getting logged out because HttpContext.Current is null


We've  been trying to fix this one for a couple years, and I'm just out of ideas, so any help is really appreciated!

We've got a fairly large, complex web application that uses Forms Authentication to authenticate users.  Throughout the application we store and retrieve information about users in the Session object, and in some cases in cookies.  In a couple places we check for the existence of the context, and if it's null we send the user back to the login page to re-establish the session. 

Just a quick run-down of this web app: C#, .NET 3.5, IIS 6, ASP.NET State Service to manage session

As for the session timer, we use our own home-grown timer, which is basically a client-side timer, which is backed up by a check to the SQL database to see when their last activity was.  This seems to work well for us.  It's not perfect, but it allows us to notify the user before the session times out, and allows us to be certain we're not logging a user out before their 60 minutes of inactivity is up.

What's happening is that certain users are being logged out after just a few minutes.  We've eliminated the timer as a cause and believe what's happening is the HttpContext.Current is null, so the user is logged out.  We do not know why the HttpContext.Current is null, and I underst

OnItemCommand not firing in Templated User Control


I have a templated user control with single instance template attribute. It works great for everything except the following scenario:


    <asp:UpdatePanel ID="upDirectoryBrowser" runat="server">
        <asp:AsyncPostBackTrigger ControlID="fsBrowser" EventName="FolderSelected" />
        <asp:AsyncPostBackTrigger ControlID="flsBrowser" EventName="FileSelected" />
        <asp:AsyncPostBackTrigger ControlID="flsBrowser" EventName="LinkSelected" />
        <table width="100%">
                <td style="width: 230px;">                        
                    <ntc:FolderSelector ID="fsBrowser" runat="server" OnFolderSelected="fsBrowser_FolderSelected"
                    OnControlException="fsBrowser_ControlException"  /> 
                    <ntc:FileSelector ID="flsBrowser" runat="server" OnFileSelected="flsBrowser_FileSelected"
                    OnControlException="fsBrowser_ControlException" O

Getting users list reporting to manager from LDAP


Dear All,

I need to get list of users reporting to a particular manager from the Active directory.

In the active directory there is manager property with contains the data in the following way.


Please help me in building the filter condition.

I am using the following

pUserName="Gegore Lid";

strSearch = "(&(objectClass=user)(objectCategory=user)((Manager cn=" + pUserName + "))";

DirectorySearcher dSearcher = new DirectorySearcher(dEntry, strSearch);

            //Account properites to load
            string[] arrPropertiesToLoad = { "displayName", "department", "manager", "sAMAccountName", "EmployeeNumber", "Title" };

          SearchResultCollection sResultColl = dSearcher.FindAll();

 the above code is not returning any result.

Please help me in this.



Use Membership but bypass / disable password usage for users


I have an application that does LDAP authentication. The authentication is done on the code behind page of my Login.aspx page. Once the user passes LDAP authentication, a cookie is set and I redirect:

FormsAuthentication.RedirectFromLoginPage(UserName.Text, False)

I would like to setup membership in my application and keep track of some user information. But due to company security requirements, I cannot store user passwords on my application. That must stay on the LDAP server only.

Is there a way to store users but disable password storage on the aspnet_membership table?

Getting list of users reporting from specific Manager from Active Directory


Dear All,

I am have requirement like displaying all the user information reporting to specific manager from Active Directory.

Please help me regarding this.



List Users from Active Directory


When i try to List the users from Active directory, i get this exception.

Error while processing.System.Runtime.InteropServices.COMException (0x80072020): An operations error occurred at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_AdsObject() at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne) at System.DirectoryServices.DirectorySearcher.FindAll()

The code i used is :

DirectoryEntry de = new DirectoryEntry(_path);DirectorySearcher deSearch = new DirectorySearcher();

deSearch.SearchRoot =de;

deSearch.Filter = "(&(objectClass=user) (cn=" + UserName +"))";

SearchResultCollection results = deSearch.FindAll();

 But the DirectoyEntry method is getting validated if i use the overloaded method : DirectoryEntry(_path, domainAndUsername, password);

Please advice me.

Going Places: Enhancing Windows Touch Applications for Mobile Users


This article describes how to use the Windows Touch API and related APIs to enhance mobile application. The discussion focuses on general usability, object selection and implementing a natural user interface.

Gus Class

MSDN Magazine December 2009

Usability in Practice: Getting Inside Your Users' Heads


This article explores techniques developers can use to gather information about and incorporate their users' mental models in their software designs.

Ambrose Little, Dr. Charles B. Kreitzberg

MSDN Magazine October 2009

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend