Extending the Active Directory User Schema

June 22, 2011 Leave a comment

Active Directory user schema has enough properties/attributes to cover most user profile information, but in some cases , we might need to extend this schema to add our own custom attributes. Microsoft Active Directory provides this capability to customize the user schema at various domain/forest hierarchy levels. The below article was tremendously helpful for us to achieve this. Thanks a lot Kurt Hudson.

http://www.informit.com/articles/article.aspx?p=169630&seqNum=3

Unique X.500 Object Id: is an  unique object identifier for an attribute. This is NOT auto-generated when extending user schema, we need to come up with one or use this script to generate one. For more information, please check Obtaining an Object Identifier from Microsoft

Getting the Current Logged in user in SharePoint 2010

June 22, 2011 2 comments

We all know the below way to get the current logged in user in SharePoint:

SPWeb web = SPContext.Current.Web;
SPUser user = web.CurrentUser;

but this actually returns the user account running the application pool identity for that site.(if the application pool is configured to run as a standalone/service user account))
Another way to get the current context logged in user is through ensuring the login name:

SPWeb web = SPContext.Current.Web;
string loginName = System.Threading.Thread.CurrentPrincipal.Identity.Name
SPUser user = web.EnsureUser(@"i:" + loginName ); // Had to Append "i:" in my case of Custom Authentication Providers

For more information, please check out SPWeb.EnsureUser

Once we have current SPUser Object, we can also get to his SP Security Groups :

SPUser user = web.EnsureUser(@"i:" + loginName );
SPGroupCollection userGroups = user.Groups;
foreach (SPGroup spgroup in userGroups)
{
}

Categories: Sharepoint 2010

Deploying SSRS 2008 Reports in sharepoint integrated mode.

March 7, 2011 Leave a comment

While deploying SSRS (SQL Server Reporting services) in SharePoint Integration mode, the deployment Path URL’s must be absolute (this includes  http://, the site collection, the path to the site,the library,). For example :

TargetServerURL - indicates which site to deploy the report. In the above example, I deployed it to a Sub-site ‘Reports’. We can even deploy it at site collection level. i.e http://dev:3660

TargetDataSourceFolder - A regular SharePoint data connection library to store & may be share the data source used by the report.

TargetReportFolder – A regular SharePoint  library to save the report.

During deployment via Business Intelligence Visual Studio, it may ask for appropriate account privileges.  Successful Output below : ——————————————————————————————————————————–

Deploying to http://dev:3660/Reports
Deploying data source ‘http://dev:3660/reports/ReportsDataSource/AWDataSource.rsds’.
Deploying report ‘http://dev:3660/reports/AWReports/AWVendors.rdl’.
Deploy complete — 0 errors, 0 warnings
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========

How to get assembly file from GAC

February 27, 2011 Leave a comment

Sometimes we may need to find assembly files (.dll) in the Microsoft windows GAC (Global Assembly Cache), while working in the world of Microsoft.NET. The default GAC folder is located at C:\Windows\assembly, but looking in this directory , we would only find the installed versions of these assemblies.

 

 

 

 

 

 

To find the actual .dll file of these installed assemblies, just

Open Dos-Prompt & type dir fullname of the assembly followed by ‘/s‘.  For example

C:\>dir Microsoft.SharePoint.IdentityModel.dll /s

Once you find the dll file, copy it to your project & enjoy coding…

AD property value data type is String or byte[]

February 17, 2011 Leave a comment

I was trying to read a property value from the user schema of an Active Directory, the mystery is that the value data type sometimes comes as byte[] & sometimes as String. As much as I do not like it, I have to rely on the type for further processing..

System.Type type = objectTemp.GetType();
    if (type == typeof(String))                    
          this.property1= objectTemp.ToString();

    if (type == typeof(byte[]))
    {   
       this.property1= System.Text.Encoding.Default.GetString((byte[])objectTemp);                  
    }         

Categories: Active Directory

Close the SharePoint 2010 Modal Dialog from the code-behind

January 25, 2011 4 comments

SharePoint 2010 introduces the new Modal dialog framework, which opens up a light-box type pop-up in the page. Chakradeep Chandran (an former sharepoint server MVP) wrote an excellent article/tutorial explaining how to use the sharepoint modal Dialog framework.

http://www.chakkaradeep.com/post/Using-the-SharePoint-2010-Modal-Dialog.aspx

In addition to the Chak’s article, If you are trying to close the SharePoint Modal Dialog from the code-behind, the below code would help

HttpContext context = HttpContext.Current;
if (HttpContext.Current.Request.QueryString["IsDlg"] != null)
{
context.Response.Write("<script type='text/javascript'>window.frameElement.commitPopup()</script>");
context.Response.Flush();
context.Response.End();
}

Testing Post by Email WordPress

January 25, 2011 Leave a comment

Here a bing background I like..

Works.. cool

Categories: Uncategorized
Follow

Get every new post delivered to your Inbox.