Showing posts with label Services. Show all posts
Showing posts with label Services. Show all posts

September 4, 2013

Get User's Properties from Active Directory through profile synchronization.

​User's Property in Active directory are there like City, Job, Birthday, Hire Date etc.
what i have done here is displaying current week's birthday(i.e Sunday to satureday) and hire date with total years of joining from active directory through userprofile synchronization.
Before i write code here, make sure that user profile does contains properties which you need, If it is not there than add that property. Also user must be there, user profile synchronization service must be started

   1:  SPSecurity.RunWithElevatedPrivileges(delegate()
   2:              {
   3:                  using (SPSite site = new SPSite(SPContext.Current.Site.RootWeb.Url))
   4:                  {
   5:                      using (SPWeb web = site.OpenWeb())
   6:                      {
   7:                          try
   8:                          {
   9:   
  10:   
  11:                              SPServiceContext spServiceContext = SPServiceContext.GetContext(site);
  12:                                                                                  
  13:   
  14:   
  15:                              UserProfileManager profileManager = new UserProfileManager(spServiceContext);
  16:                              if (profileManager == null)
  17:                                  return;
  18:                              
  19:                              startDate = DateTime.Now;
  20:                              while (startDate.DayOfWeek != DayOfWeek.Sunday)
  21:                              {
  22:                                  startDate = startDate.AddDays(-1);
  23:                              }
  24:                              endDate = startDate.AddDays(6);                            
  25:                              startdate = startDate.Day;
  26:                              startmonth = startDate.Month;
  27:                              enddate = endDate.Day;
  28:                              endmonth = endDate.Month;
  29:                              IEnumerator profileEnumerator = profileManager.GetEnumerator();
  30:                              while (profileEnumerator.MoveNext())
  31:                             
  32:                              {
  33:                                  UserProfile userProfile = profileEnumerator.Current as UserProfile;
  34:                                  if (SPContext.Current != null)
  35:                                  {
  36:                                      string userLoginName = userProfile["AccountName"].ToString();
  37:                                                                                               
  38:                                  }
  39:                                  if (userProfile == null)
  40:                                      return;
  41:                                  DataRow drbirthday = dtBirthday.NewRow();
  42:                                  DataRow drAnniversary = dtAnniversary.NewRow();
  43:                                  if (userProfile[PropertyConstants.Birthday].Value != null)
  44:                                  {
  45:                                      BirthdayDate = (DateTime)userProfile[PropertyConstants.Birthday].Value;
  46:                                      if ((BirthdayDate.Day >= startdate && BirthdayDate.Month == startmonth) && (BirthdayDate.Day <= enddate && BirthdayDate.Month == endmonth))
  47:                                      {
  48:                                          drbirthday["Name"] = userProfile[PropertyConstants.PreferredName].Value.ToString();
  49:                                          drbirthday["Date"] = BirthdayDate.Month + "/" + BirthdayDate.Day;
  50:                                          drbirthday["fullstring"] = Convert.ToString( drbirthday["Date"]) + "-" + Convert.ToString( drbirthday["Name"]);
  51:                                          dtBirthday.Rows.Add(drbirthday);
  52:                                          birthDayData.Text = birthDayData.Text + (birthDayData.Text == string.Empty? string.Empty: "; ") +Convert.ToString(drbirthday["fullstring"]);
  53:                                      }                                   
  54:                                  }
  55:                                  if (userProfile[PropertyConstants.HireDate].Value != null)
  56:                                  {
  57:                                      AnniversaryDate = (DateTime)userProfile[PropertyConstants.HireDate].Value;
  58:                                      if ((AnniversaryDate.Day == date && AnniversaryDate.Month == month ))
  59:                                      {
  60:                                          int todayyear = DateTime.Today.Year;
  61:                                          int Anniyear = AnniversaryDate.Year;
  62:                                          int totalAnniYear = todayyear - Anniyear;
  63:                                          drAnniversary["Name"] = userProfile[PropertyConstants.PreferredName].Value.ToString();
  64:                                          drAnniversary["Years"] = totalAnniYear;
  65:                                          drAnniversary["fullstring"] = Convert.ToString(drAnniversary["Name"]) + "-" + Convert.ToString(drAnniversary["Years"] + " years");
  66:                                          dtAnniversary.Rows.Add(drAnniversary);
  67:                                          AnniDayData.Text = AnniDayData.Text + (AnniDayData.Text == string.Empty? string.Empty: ", ") + Convert.ToString(drAnniversary["fullstring"]);
  68:                                      }                                    
  69:                                  }
  70:                              }
  71:   
  72:   
  73:                          }
  74:                          catch (Exception ex)
  75:                          {
  76:                              Common.ErrorLog(ex.Message + Environment.NewLine + ex.StackTrace, "GetUserBirthdayAnniversary", Microsoft.SharePoint.Administration.TraceSeverity.Unexpected);
  77:                          }
  78:   
  79:   
  80:                      }
  81:                  }
  82:              });
This will helps to get user's properties from Active Directory.

If you have any questions you can reach out our SharePoint Consulting team here.

March 29, 2013

Create and Configure Visio Graphics Services

Visio Graphics Service Overview

The Visio Graphics Service is a Microsoft SharePoint Server 2010 service application that allows users to share and view Visio web drawings using Visio Services. Visio Graphics Services allows Visio Web drawings published in VDW format to be shared with other users who may not have Visio 2010 installed on their computers. VDW formats can be created only by Visio Professional 2010 or Visio Premium 2010. Standard Visio drawings (VSD files) are not rendered by Visio Services and require Visio to be viewed.
Microsoft Visio 2010 situates diagramming to an advance level with dynamic, data-driven visualization tools, and advanced Web sharing capability. It composes data from various sources, including Microsoft SharePoint Foundation Services list, Microsoft Office Excel workbook, Microsoft Office Access database, Microsoft SQL Server database, and other OLEDB or ODBC data source and presents it using vibrant graphics design. It facilitates SharePoint workflows creation and publication for instantaneous implementation.
The Visio Graphics Service is a SharePoint Server 2010 service application that enables dynamic viewing, refreshing, and sharing of data-driven Microsoft Visio 2010 diagrams through Visio Web Access Web part, Web part Connections, and Visio Services Mash-up API. This piece will provide high-level steps in consuming this service application.

Start a Visio Graphics Service

To start a Visio Graphics Service by using Central Administration
  • Verify that you have the following administrative credentials:
    • To start a Visio Graphics Service, You must be a member of the Farm Administrators group.
  • On the Central Administration Home page, in the System Settings section, click on the Manage services on server.
  • If Visio Graphics Service is shown Stopped then click on the Start.
  • After clicking on the Start, Visio Graphics Service status is shown Started

Create a Visio Graphics Service

To create a Visio Graphics Service by using Central Administration
  • Verify that you have the following administrative credentials:
    • To create a Visio Graphics Service, You must be a member of the Farm Administrators group.
  • On the Central Administration Home page, in the Application Management section, click on the Manage service applications.
  • Click on the new ribbon and then click Visio Graphics Service.
  • In the Visio Graphics Service Application Name section, Type a name Ex- "Visio Graphics Service" in the textbox for the new service application.
  • In the Application Pool section, choose an existing Application Pool or Create a New Application pool name Ex- "Visio Graphics Service Apppool" in the textbox.
  • In the Application Pool section, choose a proper Account Ex- spservices from the Configurable dropdown.
  • Choose whether to create a Visio Graphics Service Application Proxy (recommended).
  • Click OK.

List all Visio Graphics Services

To list all the Visio Graphics Service by using Central Administration
  • On the Central Administration Home page, in the Application Management section, click on the Manage service applications.
  • The "Visio Graphics Service" is listed on the Manage Service Applications page

Delete a Visio Graphics Service

To delete a Visio Graphics Service by using Central Administration
  • Verify that you have the following administrative credentials:
    •To delete a service, you must be a member of the farm administrators group.
  • On the Central Administration Home page, in the Application Management section, click on the Manage service applications.
  • Select the Visio Graphics Service that you want to delete.
  • On the ribbon, click Delete.
  • In the confirmation dialog box, check the 'Delete data associated with the Service Applications' checkbox and click OK.

OR

To delete a Visio Graphics Service by using Windows PowerShell
  • Go to the Start menu, click All Programs.
  • Click Microsoft SharePoint 2010 Products.
  • Click SharePoint 2010 Management Shell.
  • From the Windows PowerShell command prompt (that is, PS C:\>), type the following below command and press ENTER:
    Remove-SPServiceApplication
Command: remove-spserviceapplicationpool "Visio Graphics Service Apppool"

Configure Visio Graphics Service global settings

To configure a Visio Graphics Service by using Central Administration
  • Verify that you have the following administrative credentials:
    • To delete a service, you must be a member of the farm administrators group.
  • On the Central Administration Home page, in the Application Management section, click on the Manage service applications.
  • Click the Visio Graphics Service that you want to configure.
  • On the Visio Graphics Service Settings page, configure the following settings:
    • Maximum Diagram Size = 5 MB
    • Minimum Cache Age = 5 Minutes
    • Maximum Cache Age = 60 Minutes
    • Maximum Recalc Duration = 60 Minutes
    • External Data = the target application ID in the registered Secure Store Service that is used to reference Unattended Service Account credentials.
  • Click OK.

Configure Visio Graphics Service trusted data providers

The Visio Graphics Service trusted data providers can be provisioned through Central Administration.

Data Provider ID:

The Data Provider ID is the name of the driver that acts as the data provider. This ID must be the same ID that is used to reference the data provider in a connection string. The driver for the data provider must be installed on every application server that is running the Visio Graphics Service. Once you have installed the driver on your application servers, you can add it as a trusted data provider in Visio Services in Microsoft SharePoint Server 2010.

Data Provider Type:

When adding a new trusted data provider, the data provider type must be one of the following values:
Number Type
1 OLE DB
2 SQL
3 ODBC
4 ODBC with DSN
5 SharePoint Lists
6 Custom Data Provider
Data Provider Description:
The data provider description is a friendly name that appears in the Trusted Data Providers section of the Manage the Visio Graphics Service page in SharePoint Central Administration.

Creating, editing, and deleting trusted data providers

To create a Visio Graphics Service trusted data provider by using Central Administration
  • Verify that you have the following administrative credentials:
    •To create a trusted data provider, you must be a member of the farm administrators group.
  • On the Central Administration Home page, in the Application Management section, click on the Manage service applications.
  • Click the Visio Graphics Service where you want to create the trusted data provider.
  • Click Trusted Data Providers.
  • Click Add a new Trusted Data Provider.
  • Enter values for the following parameters:
    Parameter Description
    Trusted Data Provider ID The Trusted Data Provider ID
    Trusted Data Provider Type The Data Provider type
    Trusted Data Provider Type Description Description of the Trusted Data Provider type
  • Click OK.

To edit a Visio Graphics Service trusted data provider by using Central Administration

  • Verify that you have the following administrative credentials:
    • To edit a trusted data provider, you must be a member of the farm administrators group.
  • On the Central Administration Home page, in the Application Management section, click on the Manage service applications.
  • Click the Visio Graphics Service where you want to edit the trusted data provider.
  • Click Trusted Data Providers
  • Select the data provider that you want to edit, and from the drop-down menu select Edit Trusted Data Provider.
  • Edit the settings that you want, and then click OK.

To delete a Visio Graphics Service trusted data provider by using Central Administration

  • Verify that you have the following administrative credentials:
    • To delete a trusted data provider, you must be a member of the farm administrators group.
  • On the Central Administration Home page, in the Application Management section, click on the Manage service applications.
  • Click the Visio Graphics Service where you want to delete the trusted data provider.
  • Click Trusted Data Providers.
  • Select the data provider that you want to delete, and from the drop-down menu select Delete Trusted Data Provider.

If you have any questions you can reach out our SharePoint Consulting team here.

December 31, 2012

SharePoint Fundamentals: Document ID Service

What:
The document ID feature creates identifiers that can be used to retrieve items independent of their current location. The document ID service that supports it generates and assigns document IDs.​ Read details in MSDN
How:
Just go to site collection features and enable Document ID Service feature.
Once this feature is enabled, you will see configuration link in Site Settings.

You will be able to set some configuration related to DocumentID that is auto-generated in the Document ID Settings

And finally, when you upload any document to any of the document library in site collection, you will see document Id is automatically assigned to the library.

Conclusion:
You must be thinking what is so good about this?
DocumentID service provides a web part to search any document by ID. You can place that web part in home page and anybody knowing(or not knowing) documentId that they are interested in can directly go do document whithout navigating site hierarchy. In case of multiple results list of documents will be displayed. This will work at site collection level for any document in site collection at any level deeper in site hierarchy.
References:
1.MSDN,
2.Tobias Zimmergren's blog This blog presents much more details than what I copy pasted above! It is more than enough to know whatever you know as an analyst, programmer, tester or administrator.

If you have any questions you can reach out our SharePoint Consulting team here.

April 23, 2012

Creating your first data cube.

SQL Server 2005/2008 comes along with the Business Intelligence Development Studio (also known as BIDS) which is used for creating projects related to analysis services, integration services, report server and report models (used to design reports on client side). In order to get started with BIDS to build your first analysis services project, you need to have the following SQL Server components installed: SQL Server Database Engine SQL Server Analysis Services (SSAS) Business Intelligence Development Studio A good working data warehouse Below are the steps to be followed to create the cube 

Create a new Analysis Services project

For creating a new project in BIDS, you’ll find the Business Intelligence Development Studio (BIDS) in Start > Microsoft SQL Server 2005/2008 folder. Once you’re in the business intelligence development studio, click File > New > Project from where you could create a new Analysis Services Project. Give it any name you like and click on ok. 

Define a data source

To define a data source, you'll use the Data Source Wizard. You can launch this wizard by right-clicking on the Data Sources folder in your new Analysis Services project. The wizard will walk you through the process of defining a data source for your cube, including choosing a connection and specifying security credentials to be used to connect to the data source. 

Defining a Data Source View

A data source view is a persistent set of tables from a data source that supply the data for a particular cube. BIDS also includes a wizard for creating data source views, which you can invoke by right-clicking on the Data Source Views folder in Solution Explorer. You can select from existing tables and set relations between them or enter in your own statements using “Edit Named Query”.
Now you can move further either creating Cube using Cube Wizard which automatically creates Dimensions to be used in the cube or by creating a Dimensions and using it in the Cube.

Creating Dimensions

BIDS also provides wizard for creating dimensions. It helps in defining the key columns and attributes to be in used within a cube. 

Creating Cubes

Cube wizard appears within BIDS for creating cubes where in measurement group tables are to be defined. Here option to either select from existing dimensions or create new dimensions is provided.

Deploying and Processing a Cube

To deploy the cube you just created, select Build > Deploy. This will deploy the cube to your local Analysis Server, and also process the cube, building the aggregates for you. BIDS will open the Deployment Progress window which will keep you informed during deployment and processing.

If you have any questions you can reach out our SharePoint Consulting team here.