Note that there are some explanatory texts on larger screens.

plurals
  1. POProgramming with Visio in SharePoint, create new Outlook meeting in ?Javascript?
    primarykey
    data
    text
    <p>I am doing a little Visio experimenting, and what I want to do is show a Visio file in SharePoint, the Visio file shows a layout of a building, with meeting rooms and their status + ability to book them with Outlook</p> <p>The meeting rooms are identified in Outlook as a email adress, and you can send a email to the room to book it.</p> <p>Since there is alot of rooms, and you cant see their availability before you add the room to a meeting invitation, I want to create a overview of this in Visio.</p> <p>What I have so far: Program written in C# that runs as a timer service that gets information about rooms and meetings, and write it into a SQL2008R2 database.</p> <p>2 tables:</p> <p><strong>Room:</strong> RoomEmail, RoomName, FloorNumber, Capacity, RoomStatus(Right Now)</p> <p><strong>Meeting:</strong> MeetingID, RoomEmail(FK), MeetingTitle, MeetingStatus, MeetingStartTime, MeetingEndTime.</p> <p>The Visio file is added to SharePoint and works there, updates nicely. The rooms shows as red if busy, green if free, and yellow if tentative.</p> <p>This helps alot for the status right now, but I want 2 more functionalities.</p> <ul> <li>Able to click a link somewhere in the Visio diagram or another WebPart and open the local Outlook client with a new meeting and the room in the "too" field</li> <li>Able to see scheduled meetings on the room selected, to see when it is possible to book it before you open Outlook.</li> </ul> <p>After what I've seen, it's not possible to link shapes to other then one specific row when you dataconnect shapes inside Visio, (that's why I added the roomStatus in the Room table). So far I've seen at Javascript to be able to do logics with Visio shapes.</p> <p>I added this to a Content Webpart:</p> <pre><code>&lt;script language="javascript"&gt; var app = Sys.Application; app.add_load(onApplicationLoad); // hold an instance of the Visio VWA control var vwaControl; var shapeSelectionChangedHandler = null; function onApplicationLoad() { vwaControl= new Vwa.VwaControl("WebPartWPQ4"); vwaControl.addHandler("diagramcomplete", onDiagramComplete); vwaControl.addHandler("shapeselectionchanged", shapeSelectionChangedHandler); } function onDiagramComplete() { var vwaPage = vwaControl.getActivePage(); vwaPage.setZoom(35); // force the initial zoom level } shapeSelectionChangedHandler = function(source, args) { // get the selected shape from the shapes on the page var vwaPage = vwaControl.getActivePage(); var vwaShapes = vwaPage.getShapes(); var shape = vwaShapes.getItemById(args); // get the data to display for the selected shape var data = shape.getShapeData(); var strRoomName = ""; var strFloorNumber = ""; var strCapacity = ""; var strStatus = ""; for (var j = 0; j &lt; data.length; j++) { if (data[j].label == "RoomName") { strRoomName = data[j].value; continue; } if (data[j].label == "FloorNumber") { strFloorNumber = data[j].value; continue; } if (data[j].label == "Capacity") { strCapacity = data[j].value; continue; } if (data[j].label == "RoomStatus") { strStatus = data[j].value; continue; } } // get the selected state input and set its value var inputRoomName = document.getElementById('strRoomName'); inputRoomName.value = strRoomName; var inputFloorNumber = document.getElementById('strFloorNumber'); inputFloorNumber.value = strFloorNumber; var inputCapacity = document.getElementById('strCapacity'); inputCapacity.value = strCapacity; var inputStatus = document.getElementById('strStatus'); inputStatus.value = strStatus; } &lt;/SCRIPT&gt; Room Name:&lt;br&gt; &lt;input id="strRoomName" name="Room Name" style="width: 284px" type="text" /&gt; Floor Number:&lt;br&gt; &lt;input id="strFloorNumber" name="Floor Number" style="width: 284px" type="text" /&gt; Capacity:&lt;br&gt; &lt;input id="strCapacity" name="Capacity" style="width: 284px" type="text" /&gt; Status:&lt;br&gt; &lt;input id="strStatus" name="Status" style="width: 284px" type="text" /&gt; </code></pre> <p>This code works nicely, when I click a room, it shows up in the Content Webpart. Link: <a href="http://msdn.microsoft.com/en-us/library/gg243427.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/gg243427.aspx</a></p> <p>So I have looked at some sites to be able to open Outlook from Javascript:</p> <p>Ops, cant post more links, here is the code:</p> <pre><code>function objappt(Subject, Start, Location, End, RequiredAttendees, Body) { } var objOL //As Outlook.Application; var objAppt //As Outlook.AppointmentItem; var olAppointmentItem = 1; var olMeeting = 1; objOL = new ActiveXObject("Outlook.Application"); objappt = objOL.CreateItem(olAppointmentItem); // With objappt; objappt.Subject = "My Test Appointment"; objappt.Start = "11/23/2008 9:00 AM"; objappt.End = "11/23/2008 9:45 AM"; // make it a meeting request; objappt.MeetingStatus = olMeeting; objappt.Location = "NSW"; objappt.Body = "Testing"; objappt.RequiredAttendees = "someone@somewhere.dom"; objappt.Display(); // End With; objAppt = null; objOL = null </code></pre> <p>Nr2: </p> <pre><code>//Open Meeting Request function ResMtg(cal,start,end){ //alert(cal+' - '+start+' - '+end); //Inbox = 6 //Calendar = 9 var mailFolder = ns.getDefaultFolder(9); var mailItem = mailFolder.Items.Add("IPM.Appointment.ConfRmReq"); mailItem.MeetingStatus = 1; mailItem.Subject = "**Meeting Subject**"; mailItem.Start = start; mailItem.End = end; var recipient = mailItem.Recipients.Add(cal);//attendees list recipient.Resolve; if(recipient.Resolved){mailItem.Display();} else{alert('Unable to resolve this calendar: '+cal);} } </code></pre> <p>Nr3:</p> <pre><code> var outlookApp = new ActiveXObject("Outlook.Application"); var nameSpace = outlookApp.getNameSpace("MAPI"); mailFolder = nameSpace.getDefaultFolder(6); mailItem = mailFolder.Items.add('IPM.Note.FormA'); mailItem.Subject="CUSTOMER SERVICE"; mailItem.To = document.frmM.txtEmail.value; mailItem.HTMLBody = </code></pre> <p>All of them from pretty old examples.</p> <p>I also want to show information from the meeting table linked to the selected room. I have the information about which room, but I lack the connection to the Meeting table. And I know you can't connect to the database directly in Javascript securely.</p> <p>I havn't done any coding in Javascript before, that's why I fall a little short here.</p> <p>Anyone know how I could do these 2 functionalities? I'm very grateful for any help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload