Creating Subscriptions on the SQL Reporting Server 2000

Follow the following steps for creating subscriptions
1. Log into the reporting server: http://crmServer/reports
2. Click on _MSCRM Subscriptions Folder
3. Click on the report for which the subscription needs to be created
4. Click on the Subscriptions Tab
5. Click on New Subscription
6. Under Report Delivery Options, choose ‘Report Server File Share’
7. Provide details for the File Name as mentioned below
8. Provide the path of the folder where you want to save this subscription. This folder should be in the root directory of the reporting server. The person who is creating the subscription should have Read/Write Access to this folder.
For Ex: In the development server, a folder called ‘SubscribedReports’ has been created in the C drive. If a person called DomainName\XYZ’ is creating the subscription, then DomainName\XYZ’ should have write access to the ‘Subscribed Reports’ folder. The path to be provided in the reporting server subscription page would be ‘\\.’
9. Choose the render format : PDF format
10. Provide the Username/Password.
11. Under Subscription Processing Options, click on the button ‘Select Schedule’
12. Choose the scheduling date and time and then click on OK – Scheduling Every Monday at 10.00AM for all the reports
13. Under Report Parameter Values, choose the parameters that would be applicable for the specified subscription.
14. When all of the above have been completed, click on OK.

That’s all

Finding all the opportunities shared with the user in CRM

To find the opportunity record shared with a particular user in Microsoft Dynamics Crm

select o.name as OpportunityName,p.AccessRightsMask from opportunityBase o
left join PrincipalObjectAccess
p on p.objectid=o.opportunityid left join systemuser u
on p.principalid=u.systemuserid where u.fullname=’nishant r’

or u.domainname=SYSTEM_USER

AccessRightsMask values and what they mean

AppendAccess 4 – Specifies the right to append the specified object to another object.
AppendToAccess 8 – Specifies the right to append another object to the specified object.
AssignAccess 0x80 -Specifies the right to assign the specified object to another security principal.
CreateAccess 0x10 -Specifies the right to create an instance of the object type.
DeleteAccess 0x20 -Specifies the right to delete the specified object.
ReadAccess 1 -Specifies the right to read the specified type of object.
ShareAccess 0x40 -Specifies the right to share the specified object.
WriteAccess 2 – Specifies the right to update (write to) the specified object.

3– Read + Write

65539– Read + Write + Delete

851991– All the rights

262145– Share+Read etc…

फिर मिलते हें
Bye

Create wizard like window application C#

Hi today we will see how to create wizard like window application in .NET 2.0.

1) Create a new window application.
2) Add three forms in it. I have named the form as FirstStep, SecondStep and ThirdStep.
3) In FirstStep add two button – Next and Cancel
4) In SecondStep add three button- Previous, Next and Cancel
5) In ThirdStep add two button- Previous and Cancel
6) Than add a new class file – name it WizardData.cs
7) Add following code to it

// this wizardData class will have a enumeration and a property to display the appropriate form
public class WizardData
{
public enum wizardForms
{
FirstStep =1, SecondStep=2, ThirdStep=3,Cancel =99
}
private wizardForms formToShow;
public wizardForms FormToShow
{
get
{
return formToShow;
}
set
{
formToShow=value;
}
}
}

8. Then go to program.cs and modify it in the following manner

[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
MyInitialization();

//Replace Application.Run(…. ) with MyInitialization() – custom function
}

9) The code for MyInitialization() goes like this

// Create instances of all the forms to be displayed
private static void MyInitialization()
{
WizardData wData = new WizardData();
wData.FormToShow = WizardData.wizardForms.FirstStep;
Form step1 = new FirstStep(wData);
Form step2 = new SecondStep(wData);
Form step3 = new ThirdStep(wData);
while (wData.FormToShow != WizardData.wizardForms.Cancel)
{
switch (wData.FormToShow)
{
case WizardData.wizardForms.FirstStep:
{
step1.ShowDialog();
break;
}
case WizardData.wizardForms.SecondStep:
{
step2.ShowDialog();
break;
}
case WizardData.wizardForms.ThirdStep:
{
step3.ShowDialog();
break;
}
}
}
10) Now go to your FirstStep Form. Replace the constructor with this

public FirstStep(WizardData wd)
{
this.wData = wd;
InitializeComponent();
}

11) In the cancel button and next button click event handler write the following code

private void btnNext_Click(object sender, EventArgs e)
{
// to show the SecondStep form
wData.FormToShow = WizardData.wizardForms.SecondStep;
this.Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
wData.FormToShow = WizardData.wizardForms.Cancel;
this.Close();
}

12) Repeat the same step 11 for SecondStep and ThirdStep form.
for previous button click event handler add the following code
private void btnPrevious_Click(object sender, EventArgs e)
{
// replace the wizardForm.(…) with appropriate form to be displayed
wData.FormToShow = WizardData.wizardForms.FirstStep;
this.Close();
}


That’s it

Finding no of users online ASP.NET

To do this,
1) Add a new item global.asax in your website.
2) Put the following code in it

void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
Application[“UsersOnline”] = 0;
}

void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
Application.Lock();
Application[“UsersOnline”] = (int)Application[“UsersOnline”] + 1;
Application.UnLock();
}

void Session_End(object sender, EventArgs e)
{
// Code that runs when a session ends.
// Note: The Session_End event is raised only when the sessionstate mode
// is set to InProc in the Web.config file. If session mode is set to StateServer
// or SQLServer, the event is not raised.
Application.Lock();
Application[“UsersOnline”] = (int)Application[“UsersOnline”] – 1;
Application.UnLock();
}

3) In the webpage where the no of online users have to be displayed make use of this application object

protected void Page_Load(object sender, EventArgs e)
{
Response.Write(“The no of users online are ” + Application[“UsersOnline”].ToString());
}



That’s it

Searching for an email id in Active Directory using C#

These are the steps i followed
1) Created a new windows application.
2) Added reference to System.DirectoryServices dll
3) Added a textbox(where the email id will be entered) and a button in the form.
4) On btnClick this is the code i wrote

we use the DirectorySearcher class to query the directory and read the attributes of the objects found
DirectorySearcher Dsearch = new DirectorySearcher();
EmailID = txtEmailID.Text;

The filter in an LDAP query restricts the objects that the search will return. It is the equivalent of the WHERE clause


Dsearch.Filter = “(&(objectCategory=person)(sAMAccountName=*)(mail=”+EmailID+”))”;
objectCategory=This attribute is meant to be used to group common types of objects together so that we can search across all of them. Both user and contact classes share the same objectCategory value of person.
sAMAccountName =To separate users from contacts efficiently we can make user of sAMAccountName attribute
mail =Finally the mail attribute is the attribute which we looking for. Setting it to the value entered in the textbox by the user

SearchResult sResult = Dsearch.FindOne();


A SearchResult represents a single item from a result set.The FindOne method returns a single SearchResult, representing the first result in the underlying result set. Internally, this method is calling the FindAll method and returning the first SearchResult from the SearchResultCollection

if (sResult != null)
{
txtInfo.Content = “This email id already existing”;
}
else
{
txtInfo.Content = “This email id is not found”;
}

That’s it.