I am developing a web application in asp.net web forms framework. one of the requirement of application is to save records of future appointments of user. User also want to add this appointment to his outlook calendar. Now the problem is that my code is working locally. Appointments are being saved when I test application on my local machine. But when I deploy application on live server code give error and appointment do not saves in my outlook calendar. Kindly help me how to make it work on live server. Following is the code I'm using
Private Sub AddToCalander()
Try
Dim olApp As Microsoft.Office.Interop.Outlook._Application = DirectCast(New Microsoft.Office.Interop.Outlook.Application(), Microsoft.Office.Interop.Outlook._Application)
Dim mapiNS As Microsoft.Office.Interop.Outlook.NameSpace = olApp.GetNamespace("MAPI")
Dim profile As String = ""
mapiNS.Logon(profile, Nothing, Nothing, Nothing)
Dim apt As Microsoft.Office.Interop.Outlook._AppointmentItem = DirectCast(olApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem), Microsoft.Office.Interop.Outlook._AppointmentItem)
apt.Subject = ddItineraryItems.SelectedItem.Text
apt.Body = txtPItinerary_Desc.Text
apt.Start = CDate(txtDateFromPopup.Text)
apt.End = CDate(txtDateToPopup.Text)
apt.BusyStatus = Microsoft.Office.Interop.Outlook.OlBusyStatus.olTentative
apt.AllDayEvent = False
apt.Location = dcmbDealer.SelectedItem.Text & "," & dcmbShowroom.SelectedItem.Text
apt.Save()
Catch ex As Exception
AlertMessage.showError("Unable to add itinerary detail to outlook calendar")
Exit Sub
End Try
End Sub
I get the code from here.
http://www.codeproject.com/Tips/384326/Add-to-Calender-Adding-event-to-Microsoft-Outlook
If you are going to use Outlook by Interop, then you would need to install it on your server. Without installed Outlook - it won't work.
PS. Your code will work only with Outlook account that is configured by default. And it will work only if you are using external service for appointments. Otherwise it will save that appointment just to Outlook on server, without updating it to your local Outlook
And using Interop in web applications on server side isn't a good idea, as it will starts new Outlook process every time, that is very resource expensive. Better way is to integrate with Calendar system that you are using, like Google Calendar, etc.
Related
We got web form based application with database driven user login.
Now we want to switch to windows Azure AD. I know i can create a new project and add authentication mechanism to use sign on using Azure AD (easy enough).
But what i want is to modify my existing login mechanism to support Azure AD as well with old style login.
So how can i do a simple aspx page code behind to login in Azure AD. I tried using ADAL library.
I can popup login window via this (first line)
AuthenticationContext cnts = new AuthenticationContext("https://login.windows.net/myTenant.onmicrosoft.com");
but how to get confirmation of login ??
tried below but no luck
AuthenticationResult authRes = cnts.AcquireToken("http://androidclienturi_a/", "a0cbaead-929b-4f89-8665-b02bb1f49d01", new Uri("http://localhost:55263/Default.aspx"));
Extensive research have been done, i have almost seen all forums and reltaed blogs, but i don't want to use MVC and don't want to start web application from scratch to achieve this.
I don't know this is work or not in Azure AD but This is the code which is works in dedicated server. Just changed variable names with your actual server configuration.
Dim lbAuthenticated As Boolean = False
Dim loPrincipalContext As System.DirectoryServices.AccountManagement.PrincipalContext = Nothing
loPrincipalContext = New System.DirectoryServices.AccountManagement.PrincipalContext(ContextType.ApplicationDirectory,
lsLDAPIPAddress,
lsLDAPContainer,
ContextOptions.Negotiate,
lsLDAPAdminUsername,
lsLDAPAdminPassword)
lbAuthenticated = loPrincipalContext.ValidateCredentials(lsLDAPAttribute & "=" & fsUsername & "," & lsLDAPPath,
fsPassword,
ContextOptions.SimpleBind)
I have one User getting an error message in a MS ACCESS split database. The message is "The command or action "Send Object" isn't available now." The User gets this message when they are clicking on a command button that is suppose to open GroupWise e-mail and copy text from a MSACCESS form and have the TO: FROM: and SUBJECT: lines auto-populate.
I looked at the USER's Internet Explorer settings.
I checked to see if the USER has the most recent MS JET 4.0
I provided another copy of the front-end to save to the desktop
All other Users are not experiencing this problem. I must also add that this specific User was recently upgraded to MS OFFICE 2010, like the rest of us... Any suggestions ? Thanks
For anyone passing by on Google, this worked for me. The affected users had recently upgraded to Windows 7 with 32-bit Office 2010 (although some had upgraded without issue). It also works on my local machine (Windows 7 with 64-bit Office 2010).
Instead of using DoCmd.SendObject(....):
Sub SendMail()
Dim myOb As Object
Dim AutoSend as boolean
Set myOb = CreateObject("Outlook.Application")
Set oMail = myOb.CreateItem(olMailItem)
//Set whether to send email automatically or make user press Send
AutoSend = False
With oMail
.Body = "Message text"
.Subject = "Subject line"
.To = To#example.com
.cc = cc#example.com
If AutoSend Then
.send
Else
.display
End If
End With
Set oMail = Nothing
Set oApp = Nothing
End Sub
I'm developing an auto-hosted asp.net app for Sharepoint 2013. I have to use the SPAppWebUrl token value for my requests. So I tried this :
AppManifest.xml : <StartPage>~remoteAppUrl/Pages/Index.aspx?{StandardTokens}</StartPage>
javascript :
var appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));
C# code-behind : Application["SPAppWebUrl"] = Request.QueryString["SPAppWebUrl"];
Nothing worked. Sharepoint sends values for SPHostUrl, SPLanguage, SPClientTag and SPProductNumber only. I read topics about tokens and noted this :
If there is no app web, the portion &SPAppWebUrl={AppWebUrl} is not present.
But I dont understand how I could not have an app web...
If anybody can help please. Thanks.
I had a similar problem when I was using Provider Hosted. The App Web for me wasn't coming over because I tried to use a certificate that would not work (wild card). Went through the certificate setup a second time using a self-signed certificate - then setup a dummy list and when I looked at:
string spAppUrl = Request["SPAppWebUrl"];
I'm getting back the proper value. I then use the URL to get your App web via:
System.Security.Principal.WindowsIdentity currentUser = Request.LogonUserIdentity;
using (var appContext = TokenHelper.GetS2SClientContextWithWindowsIdentity(appUri, currentUser))
{
if (appContext != null)
{
Web appWeb = appContext.Web;
appContext.Load(appWeb, w => w.Title);
appContext.ExecuteQuery();
string title = appWeb.Title;
ViewBag.SiteTitle = title;
}
}
Had exactly the same issue. The following blog post tells you how to resolve it:
SP Rest Services with Provider hosted app
Basically, since a provider-hosted app doesn't have and app web, you have to tell sharepoint to create it. You do this by adding a dummy object (site column, list, etc) to your SharePoint project. It will then create the app web and add SPAppWebUrl to the standard tokens (in the app manifest).
I have an activeX dll that was written in vb6. Inside that code it uses the LoadResPicture() to load an image that it then sends to a printer (using PaintPicture)
If I call this DLL using an ASPX page, that hosted on a Windows 2008 box running IIS 7.0, the image doesn't print.
If I call this DLL using a VBS script on the very same server, the image prints fine.
The image used to print fine when the aspx page was hosted on a Windows 2000 Server.
Here is the VBS Code:
Dim CheckCtl
set CheckCtl = CreateObject("CHECKCONTROL.CHECK")
CheckCtl.FBOAccountID = 2765
CheckCtl.includesignature = True
CheckCtl.Amount = 500.00
CheckCtl.CheckDate = #04/06/2011#
CheckCtl.Payee_L1 = "Donald Trump"
CheckCtl.Payee_L2 = "10 Park Place"
CheckCtl.Payee_L3 = "Atlantic City, NJ 00011"
CheckCtl.Payee_L4 = ""
CheckCtl.Notes = "This is a test check"
CheckCtl.SubmittedBy = "Accountant"
dim lSuccess
lSuccess = CheckCtl.Printcheck()
Here is the ASPX VB.NET Code:
Dim CheckCtl As checkcontrolNET.Check
CheckCtl = New checkcontrolNET.Check
CheckCtl.FBOAccountId = 2765
CheckCtl.IncludeSignature = True
CheckCtl.Amount = 500.0
CheckCtl.CheckDate = "04/06/2011"
CheckCtl.Payee_L1 = "Donald Trump"
CheckCtl.Payee_L2 = "10 Park Place"
CheckCtl.Payee_L3 = "Atlantic City, NJ 00011"
CheckCtl.Payee_L4 = ""
CheckCtl.notes = "This is a test check"
CheckCtl.SubmittedBy = "Accountant"
Dim lSuccess As Boolean
lSuccess = CheckCtl.printcheck()
Response.Write(lSuccess)
What am I missing?
Is your server 64-bit by any chance? According to MSDN, the .Net version of that function is only supported on 32-bit versions so its possible the same may be true for the VB6 version.
http://msdn.microsoft.com/en-us/library/ms652936.aspx
I found COM+ approach for VB ActiveX with IIS wacky. I hope you have control over VB6 Dlls code and if so, try putting this code into the VB6 class you are trying to instantiate.
Private moScriptCtx As ScriptingContext
Public Sub OnStartPage(SC As ScriptingContext)
Set moScriptCtx = SC
End Sub
You can now access Request,Response,Server etc as properties of the moScriptCtx object. ASP automagically calls OnStartPage() for you during the CreateObject execution.
[EDIT]
This may not be useful in your case if you are not useing ASP's intrinsic properties, but try enabling this on COM+ management console.
Fire up the COM+ management consoleo
Find the COM+ Application in questiono
Find the applicable component in the 'Components' folder
Right click on it and choose properties
Select the Advanced tab
Check the 'Allow IIS Intrinsic Properties' checkbox
http://blogs.msdn.com/b/distributedservices/archive/2010/04/28/iis-intrinsic-properties-are-disabled-by-default-on-windows-2008-and-windows-2008-r2.aspx
This sounds suspiciously like a permissions problem. I suspect that your Windows 2000 server ran IIS under the SYSTEM account and probably did the same with the old ASPNET worker process account.
Check that the account that the site runs under has permissions to print. Depending on how you've secured the site this could be any one of:
The application pool identity
A specific anonymous account
The IUSR account
I have a ASP .Net web appliaction written in Visual Basic .Net running on Windows Server 2003 (IIS 6) that works like the one described in How to grab AD credentials from client machine in a web application?
A user access our Intranet page and it uses Windows Authentication to identify the user. The application then looks up that user in Active Directory and grabs the attribute value for that user's IpPhone. This number is what we use for Employee ID's.
In IE8 I can access the site and Windows Auth prompts me and it appears to work but the application is unable to get my Active Directory user "IP Phone" value (AKA my Employee Number). If I add the URL to Trusted Sites, the application works grabs my Employee ID successfully.
That wouldn't be a big deal except it does this in every browser (FireFox, Safari, and Chrome). I found a workaround for Firefox (ntlm-authenticate, google 'about config' for firefox). However this app shouldn't need to be in Trusted Sites, and I believe if I can get this to work without being in Trusted Sites it will work in all browsers.
Does anyone have any idea whats going on? Thanks in advance.
Take a look at the setting in the screenshot below. The automatic logon refers to using your Windows authentication as you access resources via Internet Explorer. In other words, if you access a web page on a server in your directory, the credentials that you logged in on your machine with are automatically passed to the server you're accessing.
The credentials are generally, for some reason unknown to me, passed along to trusted sites as well. I don't know why this is, but I've seen this behavior enough to be confident stating it.
This feature is only available in IE, except for the workaround you found for Firefox, and will not work in other browsers, unless you find similar workarounds.
A better solution would be to specify the username and password in code as shown here:
http://msdn.microsoft.com/en-us/library/wh2h7eed.aspx
This performs a search and passes along a username and password, rather than relying on the Windows Integrated security.
I have a working snippet of code here for getting an email based on username in our domain, that you can modify for your needs:
Public Function GetEmailFromUserName(ByVal UserID As String) As String
Dim ReturnValue As String = ""
Dim myAD As New System.DirectoryServices.DirectoryEntry("LDAP://mydomain", System.Configuration.ConfigurationManager.AppSettings("adsearchname"), System.Configuration.ConfigurationManager.AppSettings("adsearchpwd"))
Dim searcher As New System.DirectoryServices.DirectorySearcher(myAD)
searcher.Filter = ("(anr= " & UserID & ")")
searcher.PropertiesToLoad.Add("mail")
For Each myResult As System.DirectoryServices.SearchResult In searcher.FindAll()
For Each Key As String In myResult.Properties.PropertyNames
If InStr(myResult.Properties.Item(Key).Item(0), "#") Then
ReturnValue = myResult.Properties.Item(Key).Item(0)
End If
Next
Next
Return ReturnValue
End Function