How to check for user access



  • 1. MOSS 2007 German Language Pack
    I know it has been asked many times but I still cant see an answer. When can MSDN subscribers expect to get the missing MOSS 2007 language packs for European languages like German, French, Spanish etc. I know the packs are out for sutomers with Volume Licensing Agreements. But what about MSDN subscribers? As a developer I have an urgent need for at least the German language pack and I know I'm not alone. What are the options we have, to get the problem solved?
  • 2. Page Image in MOSS2007
    Hi, I'w trying to create a custom page layout for a MOSS2007-portal, which should contain multiple Page Images. However, when I'm using two page-images both image placeholders show the last image added to the page, and when there are 12 page images on the page, no images are shown at all! Does anybody know how this can be fixed?? Regards, Sebastiaan Brozius
  • 3. Can't turn off Site Collection Use Confirmation feature
    Hi We run SharePoint Portal 2003 and WSS 2.0, fully patched and service packed, in a medium server farm configuration. We are currently having problems turning off the site collection use confirmation feature. We have unticked the "Send e-mail notifications to owners of unused site collections" option but users are continuting to recieve notification emails, in some cases for sites that have been deleted! We have even tried turning it off via each of the real servers but this hasn't worked either. Has anyone else experienced this or have any ideas of what how we could resolve this? Thanks
  • 4. Connecting MOSS 2007 with Live Communication Server 2005
    Everyone- Can MOSS 2007 connect with Live Communications Server 2005? I'm under the impression that it should be able to, but I've so far been unable to find the correct documentation. Can someone point me to the documentation on how to configure MOSS and LiveComm to work with one another? Thanks, D

Re: How to check for user access

Postby Kevin Hoffman » Sun, 10 Apr 2005 07:25:25 GMT

Well, after some further testing, I've discovered the following issue:

My code iterates through the SPWeb.Files property, and then iterates through 
the SPWeb.Folders, and then below that it iterates through the list of all 
the files in each of those folders.

When my code encounters a file that is protected, rather than skipping the 
file, it actually prompts the user for their credentials. After failing to 
supply credentials that are sufficient to see the file, the user is then 
re-directed to the "you don't have access" screen.

The behavior I would really like is to _only_ display the list of recently 
added documents _to which the user has access_ . At this point I haven't 
found a good way of determining if a user has access to the file before 
SharePoint intercepts my API call and prompts the user for credentials.

Any thoughts?

Re: How to check for user access

Postby Q3JhaWcgSGFycm93ZmllbGQ » Sun, 10 Apr 2005 15:37:02 GMT


The WSS API allows you to turn authentication on and off, I have provided a 
sample code segment to display how to use it.

// C#
bool doesUserHaveAccess = false;

// Open the site and web objects
SPSite site = new SPSite("http://localhost");
SPWeb web = site.OpenWeb();

// Don't worry about auth requests.
site.CatchAccessDeniedException = false;

// Check if the current user has access to a list
    SPlistCollection lists = web.Lists;
    SPList list = lists["Shared Documents"];

    SPPermissionCollection permissions = list.Permissions;
    doesUserHaveAccess = 

doesUserHaveAccess = false;

Hope this gets your code working how you want it.

Craig Harrowfield
Senior Solutions Consultant - OBS
Blog:  http://www.**--****.com/ 
Web:  http://www.**--****.com/ 

Re: How to check for user access

Postby Kevin Hoffman » Tue, 12 Apr 2005 22:17:45 GMT

That would work if I was accessing a list, but I'm actually iterating
through the site's Files and Folders collections, and underneath each folder
i'm iterating through the Files collection. How do I use a permissions
object to test if a user has access to a specific folder? I know that SPS
doesn't allow document-level security (much to my chagrin), but the folders
themselves are secured...

If I turn off the access denied exceptions - will the API show the user what
they don't have access to, or will it skip over the folders to which the
user doesn't have access?


"Craig Harrowfield" < XXXX@XXXXX.COM > wrote in
message news: XXXX@XXXXX.COM ...

Re: How to check for user access

Postby Kevin Hoffman » Wed, 13 Apr 2005 02:00:05 GMT

I did some experimenting and if I turn off the exception trapper for
access denied, and then wrap my access of protected folders in try/catch
blocks, everything works like a champ.

Thanks so much for the advice!!

- Kevin

"Kevin Hoffman" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...

Similar Threads:

1.Access Denied When Checking User Rights

2.Anonymous users cant access checked-out document

Hi everyone

I've enabled Anonymous access on a document library. Tested this and I can get in and see a document without providing credentials. Trouble is, when the file is checked-out, I am asked for credentials and can no longer get in as anonymous.

It was my understanding that an anonymous user should still be able to see the document as it was before check-out? Am I wrong


3.Sharepoint Document Library Check In/Check Out with Access

I have been attempting to share an Access Database which is being
developed with the Sharepoint Document Library as follows:

1. Upload original DB
2. Use Check Out/Check In so only one person updates at a time

The problem we are having is that no matter how many changes are made,
the Access DB always seems to revert back to the originally uploaded
file when it is checked back in.  Can anyone provide any insight as to
why this might happen?


4.User Checks-Out for Edit, then told file is already checked-out

Thanks in advance for any advice.

I have a couple of users who are clicking on a link to a file, they
are presented with the Read-Only/Check Out for edit dialog, they
select the "Check Out for Edit" option, does not use local drafts
folder. PowerPoint opens, the file is checked out in SharePoint, but
the file is not opened for editing and a message "File is checked out
by someone else, Open read only?"is thrown.

Additionally, if they use local drafts folder is selected, this is not
an issue. We do not wish to use local drafts, so this is not an option

I posted a similar issue occurring in Excel, but seems to be affecting
other products in Office. Is this a SharePoint issue or Office issue?
It's not happening on all machines, but has happened on multiple



5.Checking access to Sharepoint prior to use

Is there a way I can check Sharepoint log ins prior using Excel's VBA 
sharepoint features to save files to a sharepoint site?

I already have this code:

Public Const SharePointPath = "\\\sites\mysite"

   ' Determine if workbook can be checked out.
            On Error GoTo ErrorHandler
            'Fails if User not Logged into Sharepoint
            If Workbooks.CanCheckOut(Filename:=savename) = True Then
            Workbooks.CheckOut savename
            MsgBox "Checked out file from SharePoint: " & file
            End If
            'I actually don't need to open file
            'Workbooks.Open (savename)
            'Instead save over it.
            ActiveWorkbook.SaveAs Filename:=savename, 
            'Check it in -- works if I checked it Out
            If Workbooks(ActiveWorkbook.Name).CanCheckIn = True Then
savechanges:=SaveDuringClose, Comments:="", MakePublic:=True
                MsgBox file & " has been checked in."
                MsgBox "This file cannot be checked in " & _
                    "at this time.  Please try again later, " & _
                    "someone else who has write access could have it Checked 
            End If

        MsgBox ("You may not be able to log into Sharepoint Server for this 
process to work.")
        ActiveWorkbook.SaveAs Filename:=savename, FileFormat:=xlWorkbookNormal
        If Closefile = True Then ActiveWorkbook.Close 
    End If

6. Access Denied on check in -- PLS HELP

7. SharePoint Designer 2007: loss of access and check in rights

8. SharePoint 3 - Checking Out Access Databases

Return to sharepoint


Who is online

Users browsing this forum: No registered users and 78 guest