Search through Global Address List - asp.net

Is there a way to search for only givenName or LastName or emailaddress of a Contact in GAL?. Currently I have these code:
Private Sub QuickSearch() 'Working!
Dim oApp As New Outlook.Application
Dim eu As Outlook.ExchangeUser = oApp.GetNamespace("MAPI").AddressLists("Global Address List").AddressEntries("Justin Timberlake").GetExchangeUser()
If Not eu Is Nothing Then
response.write(eu.Name + ": " + eu.Alias + ", " + eu.FirstName + ", " + eu.LastName + ", " + eu.MobileTelephoneNumber + ", " + eu.Department + ", " + eu.PrimarySmtpAddress)
End If
oApp.Quit()
End Sub
Well, this one works like a Quick Search through the AddressList GAL. but one problem arises is that for example I have these contact names:
- Justin Bieber
- Justin Timberlake
And I searched for Justin, only Justin Bieber will be the result as it is the first one to be seen on the list.

You need to stop at AddressEntries and then iterate through the list
Dim oApp As New Outlook.Application
Dim aeList As Outlook.AddressEntries = oApp.GetNamespace("MAPI").AddressLists("Global Address List").AddressEntries("Justin Timberlake")
If Not aeList Is Nothing Then
For Each ae As Outlook.AddressEntry aeList
Dim eu As Outlook.ExchangeUser = ae.GetExchangeUser()
response.write(eu.Name + ": " + eu.Alias + ", " + eu.FirstName + ", " + eu.LastName + ", " + eu.MobileTelephoneNumber + ", " + eu.Department + ", " + eu.PrimarySmtpAddress)
Next
End If

Related

how to get data from excel sheet with specific code

I have one problem with my code I can not achieving mobile no from my code :
OleDbCommand cmdoledb = new OleDbCommand("Select [Phone(R)] from [nil$] where [Code]='" + treadcode + "' ", oledbConn);
mobileno = cmdoledb.ExecuteScalar().ToString();
string message = "Dear " + clientname + " Your BSE Trade Position: " + Codemsg + " Ledger balance is : " + purebalance + ". (Aadinath)";
Int64 len = message.Length;
if (!string.IsNullOrEmpty(mobileno.Trim()))
{
dsmsg.Tables[0].Rows.Add(true, message, len, mobileno, clientname, treadcode);
}
else
{
dsmsg.Tables[0].Rows.Add(true, message, len,"No Mobile Found", clientname, treadcode);
}
this is my excel sheet screen shot :

Variable 'per' not in scope error in XQuery

I am getting 'Variable 'per' not in scope error' error, when I tried to execute below code in Java.
String xq = "declare variable $per1 as document-node(element(*, xs:untyped)) := " +
"fn:parse-xml($per);" +
"declare variable $job1 as document-node(element(*, xs:untyped)) := fn:parse-xml($job);" +
"for $i in $per1//pimergednodes/Get__CompIntfc__CI_PERSONAL_DATAResponse,\n" +
" $j in $job1//jobmergednodes/Get__CompIntfc__CI_JOB_DATAResponse[PROP_EMPLID = $i/PROP_EMPLID]\n" +
"\n" +
" return\n" +
" <emp>\n" +
" {\n" +
" $i/PROP_EMPLID,\n" +
" $i/PROP_BIRTHDATE,\n" +
" <coll_names>\n" +
" {\n" +
" $i/COLL_NAME_TYPE_VW/COLL_NAMES\n" +
" }\n" +
" </coll_names>,\n" +
"\n" +
" $i/PROP_BIRTHDATE/COLL_NAME_TYPE_VW/PROP_FIRST_NAME,\n" +
" $j/COLL_JOB/PROP_DEPTID\n" +
"\n" +
" }\n" +
" </emp>";
XQDataSource xds = new oracle.xquery.xqj.OXQDataSource();
XQConnection conn = xds.getConnection();
XQPreparedExpression pEx = conn.prepareExpression(xq); ==> error raised in this call.
Can somebody help me in fixing this error.
Thanks In Advance,
Maviswa
You reference $per in fn:parse-xml($per), but your code doesn't define that variable anywhere. I see $per1, but no $per. I suspect you'll run into the same problem with $job.
For debugging, print out the xq string so you can see the XQuery by itself without all the Java string escaping, which just adds a lot of noise.

how to put white space before and after a character in text field

how to put white space before and after a character in text field
eg Text="John"
so i need whit space before and after John
You could try this:
SomeField.Text = " " + SomeField.Text + " ";
or using string.Format:
SomeField.Text = string.Format(" {0} ", SomeField.Text);
string InputValue = " " + MyTextBox.Text + " ";
Using Jquery, you could call this method...
function changeTxtBox(controlID) {
var oldValue = $(controlID).val();
var newValue = ' ' + result + ' ';
$(controlID).val(newValue)
}

sending email in from asp.net page

I want to add this to my email body and i want it to look like this but it doesnt work.
Tour: lotour.text
Date: loddate.text
Party: lolnumparty.text
first name: locfname.text
last name: loclname.text
as you see i want them right after another and it doesnt work when i use a </br>
this is my email body.
objEmail.Body = "There was a booking rquest made by " & Request.QueryString("comp") & " to see more details click the link " + x
this is my full code
If Page.IsValid And ValidateCCNumber(cardnumber.Text) = True Then
SqlDataSource1.Insert()
Dim x As String
x = "http://www.clubabc.com/bookingrequest/confirm.aspx?date=" & HttpUtility.UrlEncode(now.Text) & "&tfname=" & HttpUtility.UrlEncode(p1fname.Text) & "&tlname=" & HttpUtility.UrlEncode(p1lname.Text) & "&comp=" & HttpUtility.UrlEncode(Request.QueryString("comp") & "&land=" & HttpUtility.UrlEncode(land.Text))
Dim objEmail As New MailMessage()
objEmail.To = "cnna#BC.com"
objEmail.From = "page#bc.com"
objEmail.Cc = memail.Text
objEmail.Subject = "Booking for " + p1fname.Text + " " + p1lname.Text + " made by " & Request.QueryString("comp")
objEmail.Body = "There was a booking rquest made by " & Request.QueryString("comp") & " to see more details click the link " + x
SmtpMail.SmtpServer = "mail.bc.com"
Try
SmtpMail.Send(objEmail)
Catch exc As Exception
Response.Write("Send failure: " + exc.ToString())
End Try
Response.Redirect("http://www.clubabc.com/bookingrequest/confirm.aspx?date=" + now.Text + "&tfname=" + p1fname.Text + "&tlname=" + p1lname.Text + "&comp=" + Request.QueryString("comp") & "&land=" & HttpUtility.UrlEncode(land.Text))
ElseIf ValidateCCNumber(cardnumber.Text) = False Then
invalidcard.Visible = True
End If
I guess you are searching for (MSDN):
Environment.NewLine
The <br> tag will only work in HTML Emails.
Update
This would be a very simple example, how you could use Environment.NewLine:
Imports System
Class Sample
Public Shared Sub Main()
Dim firstName As String = "John"
Dim lastName As String = "Doe"
Dim city As String = "Brooklyn"
Console.WriteLine("First name: " + firstName + Environment.NewLine + "Last name: " + lastName + Environment.NewLine + "City: " + city + Environment.NewLine)
End Sub
End Class
Try to set IsHtml property for objEmail variable to get some more formatting possibilities.
Do not use Enviornment.NewLine, instead use vbCrLf
Environment.NewLine may only output Cr or Lf, which may cause your email to either:
a)Be blocked because it's not RFC complient
or
b)Be marked as spammy
To have new lines in email, always use CrLf.
--Dave

Why does this query give me an exception?

string updateIncomeData = #"INSERT INTO TEAM_FUNDS_DETAILS("
+ "COMPONENT_TYPE,COMPONENT_NAME,COMPONENT_AMOUNT, YEAR_FOR, MONTH_FOR)"
+ "VALUES(" + Convert.ToInt32(TeamFundDetailsEnumClass.ComponentType.Income)
+ " , ?, ?,"
+ ddlYear.SelectedIndex + ", " + ddlMonth.SelectedIndex + ")"
This parametrized query gives me an exception that tells me that there is an error near "?". What is the error. Please correct it.
I am purely guessing but should it be year.selecteditem? not selectedindex?
I don't understand why you would want to mix up the parameter substitution.
Specify all five columns as parameters and set the values that way.
"INSERT INTO TEAM_FUNDS_DETAILS " +
"(COMPONENT_TYPE,COMPONENT_NAME,COMPONENT_AMOUNT, YEAR_FOR, MONTH_FOR) " +
"VALUES(? , ?, ?,?, ?)"
You must set the parameterized values (the ones with the question mark). Here is a similar example in VB.NET:
' Make a Command for this connection
' and this transaction.
Dim cmd As New OleDb.OleDbCommand( _
"SELECT * FROM People WHERE FirstName=? AND " & _
"LastName=?", _
connUsers)
' Create parameters for the query.
cmd.Parameters.Add(New _
OleDb.OleDbParameter("FirstName", first_name))
cmd.Parameters.Add(New OleDb.OleDbParameter("LastName", _
last_name))
If you don't want to use parameterized queries, just substitute the question mark with the default value, or the variable with the value:
string updateIncomeData = #"INSERT INTO TEAM_FUNDS_DETAILS("
+ "COMPONENT_TYPE,COMPONENT_NAME,COMPONENT_AMOUNT, YEAR_FOR, MONTH_FOR)"
+ "VALUES(" + Convert.ToInt32(TeamFundDetailsEnumClass.ComponentType.Income)
+ " , '', 0,"
+ ddlYear.SelectedIndex + ", " + ddlMonth.SelectedIndex + ")"
or
string updateIncomeData = #"INSERT INTO TEAM_FUNDS_DETAILS("
+ "COMPONENT_TYPE,COMPONENT_NAME,COMPONENT_AMOUNT, YEAR_FOR, MONTH_FOR)"
+ "VALUES(" + Convert.ToInt32(TeamFundDetailsEnumClass.ComponentType.Income)
+ " , '" + myComponentName + "', " + myComponentAmount,"
+ ddlYear.SelectedIndex + ", " + ddlMonth.SelectedIndex + ")"
ddlMonth.SelectedItem.Value

Resources