Infopath Time Off Request For on Sharepoint Coding in C#

So I have created a Time Off Request form to put up on our internal company intranet sharepoint site. 
I am trying to get this form to do several things.
First of all, after the user fills out the form they can click the submit button and it will email it to their manager.  That part is working fine.
The other button is the one that I am having trouble with.
Once the Manager receives the request I want them to be able to click a 2nd "approve" button and make the following happen:
A calendar entry is automatically created in the managers calendar for the day/days requested off.  It needs to be created as an All Day Event and Marked Private.
An appointment invitation needs to be sent to the requester so they can accept and the day/days will be added to their calendar as well.
An email needs to be sent to the Requester telling them their request has been approved.
Here is the code I have so far.  It is in C#
using Microsoft.Office.InfoPath;
using System;
using System.Windows.Forms;
using System.Xml;
using System.Xml.XPath;
using mshtml;
using Outlook = Microsoft.Office.Interop.Outlook;
using System.Reflection;
using System.Net;
using System.Net.Mail;
namespace ITTimeOffRequest
    public partial class FormCode
        public void InternalStartup()
            ((ButtonEvent)EventManager.ControlEvents["CTRL10_2"]).Clicked += new            ClickedEventHandler(CTRL10_2_Clicked);
        public void CTRL10_2_Clicked(object sender, ClickedEventArgs e)
            // Get a reference to the Main datasource
            XPathNavigator root = MainDataSource.CreateNavigator();
            // Create an Outlook application
            Outlook.Application outlookApp = new Outlook.Application();
            // Get NameSpace and Logon
            Outlook.NameSpace outlookNS = outlookApp.GetNamespace("mapi");
            outlookNS.Logon("arochelle", Missing.Value, false, true);
            // Create a new AppointmentItem
            Outlook.AppointmentItem appointmentItem =
          (Outlook.AppointmentItem)outlookApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
            appointmentItem.Sensitivity = Microsoft.Office.Interop.Outlook.OlSensitivity.olPrivate;
            appointmentItem.AllDayEvent = true;
            appointmentItem.ReminderSet = true;
            appointmentItem.ReminderMinutesBeforeStart = 5;
            appointmentItem.BusyStatus = Outlook.OlBusyStatus.olBusy;
            appointmentItem.IsOnlineMeeting = false;
            appointmentItem.OptionalAttendees = root.SelectSingleNode("//my:field2", NamespaceManager).Value;
            appointmentItem.Subject = ("Time Off Request");
            appointmentItem.Body = ("Date of request") + root.SelectSingleNode("//my:field4", NamespaceManager).Value;
            appointmentItem.Location = root.SelectSingleNode("//my:field13", NamespaceManager).Value;
            //appointmentItem.Start.Day.ToString = root.SelectSingleNode("//my:field10", NamespaceManager).Value;
            //appointmentItem.End.Day.ToString = root.SelectSingleNode("//my:field10", NamespaceManager).Value;
            //appointmentItem.Start = DateTimePicker.("//my:field10");
            //appointmentItem.End = DateTimePicker("//my:field10");
            appointmentItem.Start = DateTime.Parse("//my:field10");
            // Save to Calendar
            appointmentItem.Save();
            // Logoff
            outlookNS.Logoff();
            // Clean up
            appointmentItem = null;
            outlookNS = null;
            outlookApp = null;
            // Send Email Confirmation.
            SmtpClient client = new SmtpClient();
            client.Port = 25;
            client.Host = "sw-exchange";
            client.EnableSsl = false;
            client.Timeout = 10000;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            MailMessage mm = new MailMessage("<manager email address here", "//my:field2", "Your Time Off Has Been
                Approved", "Your Time Off Has Been Approved");
            mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
            client.Send(mm);
Obviously i'm trying to get the code to pull in a lot of the information from the fields people have filled on on the form.  For example in the send email confirmation section Field 2 is the choose emplayee email drop down box on the form.  CTRL10_2
is the approve button.  Field 10 is the day requested off.  The form has five lines to request days off on it and each line has a date picker to choose the day.  A text field for number of hours requested off, a Time field for Start Time, a
Time field for End Time and a Drop down box to pick Sick Leave or Annual Leave.
I'm having a problem with creating the appointment on the appropriate day in the managers calendar and then sending the appointment request to the requester.  That is where the code errors out.  This is only the coding for the first line of time
off requests as well, i'm not sure how to change the code so that it will include all 5 request lines unless I have to use some kind of Matrix or something.
I'm trying to get the appointmentitem.start and .end to pull from the date(s) that have been requested off but what happens so far is that when the approve button is clicked it just crates a private all day calendar entry for the current day on the managers
calendar and doesn't generate the appointment request for the requester or send the confirmation email.
Any help would be greatly greatly appreciated.

for the electronic form:
since you're on Standard edition, I wouldn't recommend InfoPath... I'd start with standard SharePoint list (using attachments for scanned images)... if it needs to be customized, I'd use web dev approaches (HTML+JavaScript), since we've found this approach
to be VERY upgradable.
For the process:
Assuming the process is LINEAR, I'd use SharePoint Designer with an approval process activity and a task activity (for AP). If the process is NOT linear, I'd look into a third party component like Nintex or K2 (you may find some people who say "just build
it with Visual Studio"... don't. You'll regret it later, and the business will too).
Scott Brickey
MCTS, MCPD, MCITP
www.sbrickey.com
Strategic Data Systems - for all your SharePoint needs

Similar Messages

  • Source of Time-off Request Project

    Hi,
    I am new to CAF guided procedures, I am trying to implement the Callableobject in webdynpro(java) same as time-off request. in gallery>examples>Time-offrequset, will clear my doubts. so how can i get the DCs
                 com.sap.caf.eu.gp.example.timeoff.wd.create.CCreate
                 com.sap.caf.eu.gp.example.timeoff.wd.approve.CApprove
                  com.sap.caf.eu.gp.example.timeoff.wd.complete.CComplete
                  com.sap.caf.eu.gp.example.timeoff.wd.display.CDisplay
    Regards,
    Naga

    Hi Chandan,
    Thanks For your reply.
    todo These  things, i needed from the source.
    1. When we open the time-off process , its opening webdynpro view directly, without clicking execute button. how can we achive it?, i tried the example "Designing a process from the scratch" , but didnt get it.(its directly opening webdynpro screen when i click the initiate the process, how can i acieve this?)
    2.How can we allocate the action to processors in run time?
    3.when we initiating a process its not not asking the stepsfill input, edit roles ? how can we achive this?
    Regards,
    Naga

  • Guided Procedures - Runtime "Create Time-off Request"

    Hi Everyone,
    I’ve created a Time-Off Process using the tutorial downloaded from SDN site.
    When I try to start the Runtime project (Employee side) I find the “Processors Table” in "Create Time-off Request" screen.
    The Approver name is not correct… is not what I expected!
    1) How can I change (in the Design Time project/area) the Approver and HR Consultant parameters?
    2) How can I hide (in the Runtime area) the “Processors Table”? 
    Furthermore, I would like to have more information about the “Parameters Consolidation” meaning. Could you help me to catch this meaning?
    Thanks in advance,
    Enrico

    Hi David,
    thanks for you useful answer! You gave me an answer of 80%!
    Now I try to explain you my problem for the other 20%!
    Now, ... I can't modify the Time-Off exemple, right?! But I would just like to start from this example and modify it!!!
    Can I do it starting from the project code?!
    Can I see the code lines which describe the Time-Off behaviour, so that I can customize it???? ... enfact, if I could do it, I wouldn't have to rewrite the whole code, and I also could understand the logic of TimeOff project structure.
    Do you understand me? Was I clear?

  • I have a report with 2 queries and prompts on same object tell me how many times it request for I/P?

    Hi
    i have a report with 2 queries and prompts on same object tell me how many times it request for I/P? can any one please guide me.
    Regards,
    Mahendra

    Is this question related to Dashboards or webi ?

  • Turn off request for apple id

    every time I turn on my ipod, it asks for my apple id. I have never used apple radio nor want to. How do you turn this thing off. Ipod never used to do this before. Even trying to turn on voice memo record it pops up again. I'm recording somthing, why do I need to sign into apple to do it? It's one of the stupi

    Error 1009
    https://discussions.apple.com/message/22788834#22788834
    https://discussions.apple.com/message/18497695#18497695
    amin1377 wrote:
    Hi
    Can you help me????
    My Apple ID don't work and send me (error code:1009)
    I change the country but send me (error code:1009)
    I can't download.
    My Apple ID :
    ID:xxxxxxxx
    Pass:xxxx

  • Request for switch off protection in coming new iphone.

    Dear apple
    Subject- Request for switch off protection in coming new iphone.
    I am a very new customer of yours, have bought a iPhone 5s on 25th Dec '13, but unfortunately someone stolen my phone in a MELA in my city. I immediately call my iphone but getting it switch off, as the thief had put the phone in switch off mode. I search it in iCloud with find my iphone apps but getting offline till date. I use pass code & finger print protection that's why probably it can't be use by the thief, but it can be sell as spare parts by opening up its parts . I had do all legal formalities & inform my carrier to lock my sim. Recently I again bought a new iPhone 4s 8GB from amazon.com & using it now.
    It is the time to welcoming new iphone probably iphone 6/iphone air in this fall. I have plan to buy it & a apple laptop but first iphone 6 followed by iwatch if you launch & than laptop.
    Now coming to the main point why I have written this mail let's explain it - I think you should put a switch off protection in this new device so that someone can't put the phone in switch off mode except the owner, at-least phone can be track till the battery last if someone stollen it. Because I know the problem & pain when someone lose a smart phone with all personal details. So please consider this in your new device as a new feature.
    I have given the details of my both phone -
    1.iphone 5s Gold
    IMEI no
    SL no F2******RC6
    Parts no MF354HN/A
    2. iPhone 4s 8GB black
    IMEI no
    SL no C8*****ML6
    Parts noMF265HN/A
    Thanking you
    Dr Jyoti Prasad Rajkhowa
    Sivsagar
    Assam
    India
    <Edited by Host>

    This is a user-to-user forum. If you wish to offer Apple feedback, you can do so here: http://www.apple.com/feedback/
    As for your suggestion, as much as I can understand what you are requesting, if the device is turned off, it is off. There isn't anything Apple or your carrier can do about that. Having a device that is OFF continue to send a signal suggest all sorts of privacy and battery management issues. 

  • How sharepoint understand when user requests for web applications by their DNS names

    HI
    I configured Alternate access mapping in my sharepoint farm for default ,intranet zones
    and spt farm has two web front end servers and they load balancing by F5 device
    in WFE servers there are different web applications are running on different ports
    so here I want to know how load balancing works, load balancing configured in F5 device.
    when users request a webapplication from browser (ex http://cms) where this request will go
    1)when I ping cms and other web applicaations  it returns me a loadbalancer  server IP  for all web applications;
    ping cms : it returns 10.xxx.0.80 , same ip returns when I ping for other web app
    but ex CMS web application run on the 10.xxx.1.26:81 port in sharepoint server
    2) and these sharepoint web applications running on different ports in sharepoint  web servers , so here  how sharepoint understand when user requests for web applications by their DNS names
    http://cms and http://products  etc
    adil

    I'm not sure if the F5 can add a port number (I'm not an expert on load balancers).  But in general if you design the SharePoint site to run on port 81 then you need to have port 81 appended to the request or it won't work.  http://cms in your
    example would take you to http://cms:80 not http://cms:81.  But in general DNS will resolve the address back to the F5 load balancer.  The load balancer will look at the header of the HTTP request (which contains the original address you requested)
    and forward the request to the appropriate web front end IP address.  If your web front end is using one IP address for multiple sites then those sites need to be differntiated by using a custom port like 81 (which must be included in the original request)
    or because a host header was bound to the web application when it was created.  If they are running on different port numbers then the request must include the port number by the time it gets to the SharePoint server.
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • Load Test Results - time series request data for by URL in VS2013

    I am trying to figure out how to export and then analyze the results of a load test, but after the test is over it seems I cannot find the data for each individual request by url. This data shows during the load test itself, but after it is over it seems
    as if that data is no longer accessible and all I can find are totals. The data that I want is under the "Page response time" graph on the graphs window during the test. I know this is not the response time for every single request and is probably
    averaged, but that would suffice for the calculations I want to make. 
    I have looked in the database on my local machine (LoadTest2010, where all of the summary data is stored) and I cannot find the data I'm looking for. 
    My goal is to plot (probably in excel) each request url against the user load and analyze the slope of the response time averages to determine which requests scale the worst (and best). During the load test I can see this data and get a visual idea but when
    it ends I cannot seem to find it to export. 
    A) Can this data be exported from within visual studio? Is there a setting required to make VS persist this data to the database? I have, from under Run Settings, the "Results" section "Timing Details Storage" set to "All individual
    details" and the Storage Type set to "Database". 
    B) If this data isn't available from within VS, is it in any of the tables in the LoadTest2010 database where all of the summary data is stored?
    Thanks
    Luke

    Hi Luke,
    Since the load test is used to
    simulate many users accessing a server at the same time, it is mainly verify a wev server load stress.
    As you said that you want to find the data
    for each individual request by url, I know that generally we can analyze the url request from the Summary like the following screen shot.
    >>I
    have looked in the database on my local machine (LoadTest2010, where all of the summary data is stored) and I cannot find the data I'm looking for. 
    I suggest you can try to add the
    SQL Tracing Connect String in the Run Setting properties to trace the data.
    Reference:
    https://social.msdn.microsoft.com/Forums/en-US/74ff1c3e-cdc5-403a-b82f-66fbd36b1cc2/sql-server-tracing-in-visual-studio-load-test?forum=vstest
    In addition, you can try to create an excel to analyze the load test result, for more information:
    http://msdn.microsoft.com/en-us/library/dd997707.aspx
    Hope it help you!
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • HT4528 Hello.  I recently upgraded my iPhone 4 to ios7.  Since the upgrade, my phone turns itself off at the same time every night, for about 30 minutes.  I have no idea why.  Any suggestions?

    I recently upgrade to iOS 7, and since then, my iPhone turns off automatically at the same time every night for about 30.  Why does this happen, and what setting can I change to prevent it?

    Is Do Not Disturb turned on? Do you see a quarter-moon icon up top in the status bar?

  • I have a lot of HD video on my hard drive that I eventually want to edit in iMovie, but just don't have the time now.  It is clogging up the computer, though.  How do I take the Hd clips off Mac for later editing?

    I have a lot of HD video on my hard drive that I eventually want to edit in iMovie, but just don't have the time now.  It is clogging up the computer, though.  How do I take the Hd clips off Mac for later editing?

    See "Storage drive" here
    Most commonly used backup methods
    Th problem with HD video is it needs a fast external interface, so you should pick a external drive that uses the fastest interface your computer has to offer.
    Performance rank fastest to slowest is
    Thunderbolt, USB3, (newer Mac's)
    Firewire 800, USB 2, Firewire 400, USB 1 (older Mac's)
    Newer Windows PC's have USB3, older one's USB 2,1.
    You need to format the drive if it comes FAT which a lot do, as FAT has a 4GB file size limit, so this won't work with large HD video files.
    So if your  going to use the drive only with a Mac, then head to Utlities > Disk Utility and format it Options: GUID Format: OS X Extended Journaled. (select the drive makers name and click Partition tab)
    If your going to use the external drive with a PC, take it to the oldest PC you have and right click and format exFAT.
    If you have a Windows XP machine and there is no exFAT, it can be downloaded for free from Microsoft.
    Drives, partitions, formatting w/Mac's + PC's

  • HT5312 I cant remember the answer to some questions and they blocked my account. I've been sending requests for them to send it to my mail like 20 times and nothing. What can I do?

    I cant remember the answer to some questions and they blocked my account. I've been sending requests for them to send it to my mail like 20 times and nothing. What can I do?

    Click here, phone Apple, and ask for the Account Security team.
    (87657)

  • How can I turn off Keychain from asking for my password EVERY time I check for mail?

    how can I turn off Keychain from asking for my password EVERY time I check for mail?
    This is really driving me nuts.....
    Thanks

    Choose Apple menu > System Preferences, click Security & Privacy, and then click General. 
    Open the General pane of Security & Privacy preferences
    2.     Select “Require password...NEVER after sleep or screen saver begins.”  You can adjust the amount of delay before a password is required in the pop-up menu.
    From what I am aware, you cannot turn off the keychain.
    I hope this helps.
    This is also a link that might help http://macs.about.com/od/systempreferences/ss/Mac-Security-Using-The-Mac-Securit y-Preference-Pane_2.htm

  • Itunes popup on mac requesting for my password, how to turn it off?

    When I click the play button on my mac to listen to music it doesn't turn on because itunes keeps requesting for my password for automatic downloads. How do I stop this? It just started after I got my iphone.

    @ Ivmedic...    Disabling automatic downloads does not resolve this issue.  I am having the same issue. I open iTunes and get prompted for my log in info for automatic downloads, if you log in the issue returns the next time you open iTunes same as if you hit cancel. Also you actually have to go through this 2 times when opening iTunes before it stops...  Certainly a bug in the 10.5.1 (42) build.  
    Does anyone know a way of disabling it in the terminal ?

  • TS3999 calandar on my macpro says its off an when I try to take it online I get this message: The request for account "iCloud" failed.  The server responded with "507" to operation CalDAVAddCalendarQueueableOperation.

    My calandar on mac pro isn't online, when I try to take it online it says:
    The request for account “iCloud” failed.
    The server responded with
    “507”
    to operation CalDAVAddCalendarQueueableOperation.
    How do I fix it? It's not syncing with my phone or ipad or icloud online. Thanks

    In System Preferences>iCloud, click the account button, log off then back on.

  • Change Request Management in Sharepoint

    Hi - I've read through pages and pages of online content on ticketing/support systems etc. and somehow still can't seem to find something that best
    matches what I want to achieve - So hoping someone can help...
    I work in an IT Development office, and we currently have a very poor process in place for when clients submit change requests for our products
    (systems). This comprises of client fills out excel form and sends to mailbox (and most of the time, 10 other recipients not needing to be CC), we pick up email and manually copy to list on Sharepoint, we review request and update excel doc on sharepoint,
    then email user to check sharepoint for updates. Alongside this, any additional requests for info, etc. are all done by phone/email amongst various members of the development team, and also any comments we make about the request (which should only be visible
    to us) are held on a separate list. Finally, we have an issue that all of the costing information is put into a tab in the excel document, which in theory can be opened by anyone who visits the list on sharepoint.
    The process I WANT to have in place is as follows:
    Client can login to Sharepoint and see options to either review open requests (only seeing request ID/Name and status) or submit a new request
    Client fills out form online to submit new request, upon submission 3 things happen:
    A) Client receives auto email thanking for request and advising of lead times for response, ideally with a pdf or similar copy
    of their submission
    B) IT Team receive an email stating there is a new request submission, ideally with a pdf copy of the request
    C) Request goes into a list on Sharepoint, and then appears in two areas, one where the clients can see the request name and status only, and a second where the development team can see all of the information,
    and make internal comments on the record which are invisible to the client. Finally, the client should ideally be able to click through on the status list to see the full request and our response/costings etc. However only the requester should be able
    to see this much information about their request
    IT Team review request, update status and provide feedback inc. costings where appropriate. Each time the status is changed on the request, it should email
    the requester to advise the record has been updated/moved forward
    So far the best I can do is customise a form in Infopath to show how I want to layout the client submission form, and get that to go straight into a list. The list being visible to any user on our global Sharepoint site, including them being able to click
    through and see any of the information listed.
    I'm relatively new to Sharepoint, and although I've achieved quite a lot in the short time I've been working with it, I just cannot seem to get my head around how to best do this. So some help would be really appreciated!

    Hi - I've tried downloading SPD2010 on another pc, and attempted to use this to create a new workflow where I could use the Copy List Item function. However everytime I go through the process of trying to add a new workflow to my list, it lets me type in
    a title and description, press OK, and it tells me to wait a moment, then the box disappears and I'm left on the same screen I started on with no new workflow added? I've tried this over and over this evening with no joy...
    On your other option to create a new list item and populate using other fields, A. will this mean I have to write the copy for every field in my list? (I have about 40-50 fields, and I have to create 5 of these workflows in order to move my process through
    the way I need it to), and B. surely if I delete the list item after telling it to pull from the other list, wont my data then disappear also considering it's pulling from there?
    Thanks.

Maybe you are looking for

  • Mega 180 Temps

    Let me start off by saying that the Mega 180 is a great idea for a product but unfortunately it is not finished.  MSI is using us as beta testers - at our expense.  I build computers for people as a side business and against my better judgement, I bu

  • Trying to get the last row from a resultset

    Hi, I'm trying to do a query to postgreSQL and have it return the last updated value, (last row). My prepared statement is returning the correct results, but i'm having a problem getting the latest value. I'm using a comboBox to drive a textfield, to

  • How to implement search engine for pdf file.

    Hi I am newbie to AIR technolgy .how  to implement search engine . when i enter the name of file in search box , it should fetch correspoding  the pdf file . Please help me out Thanks Mohan

  • Site Studio - Fragment question

    Hi, Is it possible to have dynamic listing within static list element. I have a Fragment in my page for static listing, Fragment contains number of elements of which one is custom element with radio button. Script says if Radio button A is selected d

  • Files changed ( names)

    Hi, I edited photos in Photoshop and saved them in a map. Now finisfhed, I did decide to make a catalog to better compare them. So in the finder I saw all my 800 edited photos in three different maps. I made a new catalog and swiped the three maps un