c# - Is it possible to programmatically determine the type of a SharePoint object? -


I am using the SharePoint 2007 object model API to play a role for the SharePoint object, but when you do this , You should already know the type of SharePoint object, such as:

  // Apply a new role loyalty to the folder if you want (ie the SPFI.it ... SP folder Instead .at.in) folders, you can do this at the list level. Item.roll associations. Add (role assignment);  

(code snippet from)

I want to implement a method that is able to cross the SharePoint object, to determine the type of SharePoint object Do this:

  Public Static Balls Assenorol (String Spub URL, Object Spobbatch, Spoiler Outer, String Sprildiffinition); Example SharePoint object type would be: SPS ite, SPWeb, SPList, SPITIT, SPfield, SPFolder  

Any help to deal with the issue of determining the type of type SharePoint object will be highly appreciated.

SidNet:
(sort of), if you know that the object is located in the site, then this is not really a route, although I know completely enough to go down.

I think you do not want to duplicate the code?

Why not use SPRoleAssignmentCollection instead of the object?

asynchron (string spWebUrl, SPRoleAssignmentCollection spAssignmentCollection, SPUser oUser, string spRoleDefinition);

And you call the function

  asynroll (spWebUrl, spObject.RoleAssignments, oUser, spRoleDefinition);  
  instead of  asynchronous (spWebUrl, spObject, oUser, spRoleDefinition)  

;

If you really want to pass an object, at least the following options are

  • is the keyword
  • Use GetType and TypeOf methods to compare for type identification.

For an example of the above use and also see the difference:

I would not, however, be advised to have such a method.

What prevents the user from passing through the list? You will now need an exception which is thrown (or return value) when passed in an invalid object.

In addition, what if SharePoint adds new objects that can be assigned role? If you have already sent this code to many customers, will you send an update now?

Hope this helps, good luck!


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -