cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1293
Views
15
Helpful
10
Replies

UCCX getting infomation from sharepoint calendar.

I am trying to setup a script to call the primary or secondary on call listed in a SharePoint calendar.  The SharePoint team has provided us with an XML export of the calendar.  I am needing help on how to pull the primary and secondary number for the person on call for today.  I don’t know how I would be able to look at the start and end time and only pull the primary and secondary contact information from the section for the current date.  Any assistance would be appreciated. 

 

<Department Name="Telecom">
    <StartTime>2017-08-31 00:00:00</StartTime>
    <EndTime>2017-08-31 23:59:00</EndTime>
    <Description>&lt;div&gt;&lt;/div&gt;</Description>
    <Notes></Notes>
    <PrimaryContact Name="Doe, John">
      <PrimaryContactBusinessPhone>123-456-7890</PrimaryContactBusinessPhone>
      <PrimaryContactMobileNumber>123-567-8901</PrimaryContactMobileNumber>
      <PrimaryContactHomePhone />
    </PrimaryContact>
    <SecondaryContact Name="Doe, Jane">
      <SecondaryContactBusinessPhone>123-678-9012</SecondaryContactBusinessPhone>
      <SecondaryContactMobileNumber>123-789-0123</SecondaryContactMobileNumber>
      <SecondaryContactHomePhone />
    </SecondaryContact>
</Department>

 <Department Name="Windows Server">
    <StartTime>2017-11-27 00:00:00</StartTime>
    <EndTime>2017-12-03 23:59:00</EndTime>
    <Description>&lt;div&gt;&lt;/div&gt;</Description>
    <Notes></Notes>

   <PrimaryContact Name="Doe, John">
      <PrimaryContactBusinessPhone>123-456-7890</PrimaryContactBusinessPhone>
      <PrimaryContactMobileNumber>123-567-8901</PrimaryContactMobileNumber>
      <PrimaryContactHomePhone />
    </PrimaryContact>
    <SecondaryContact Name="Doe, Jane">
      <SecondaryContactBusinessPhone>123-678-9012</SecondaryContactBusinessPhone>
      <SecondaryContactMobileNumber>123-789-0123</SecondaryContactMobileNumber>
      <SecondaryContactHomePhone />
    </SecondaryContact>
</Department>

1 Accepted Solution

Accepted Solutions

This image is a little busy, but it shows that the Xpather XPATH expression and the UCCX editor return the same value.  Now, mine is slightly different than yours, so don't take it as the answer, but do use it as a guide.  Did you also remove the time from the data as well?  I don't see how the comparison of StartTime<='20190201' would work, with the time in there, so I assumed you removed it, and therefore, so did I.

 

xpather.png

View solution in original post

10 Replies 10

Anthony Holloway
Cisco Employee
Cisco Employee
This should be pretty easy, but I have two questions for you first:

1) Are you able to pull this XML in real-time from SharePoint, or are you always going to be given the XML export of the data manually? It would be best to pull this in real-time, though if the dates do not change frequently, I suppose a manual upload would be ok.

2) Is there a different on call person for each department, or is there a singular on call person (or team rather), and it just rotates between departments? In other words, just by looking at your XML, I cannot ascertain how your on call schedule works. Help?

Anthony,

1.  We are going to be getting an automated daily export of the XML file. (that will overwirte the old version.)

2. There is a different person on call for each department.  Some teams change who is on call every day others every week.

 

Thank you,

Anthony

Ok, let's build this thing up one step at a time.

 

First up, using the following website should be helpful in testing your XPATH expressions: http://xpather.com/

 

Second, using the following website should give you an idea of how XPATH works:  https://www.w3schools.com/xml/xpath_syntax.asp

 

Third, in UCCX, you'll want to save the XML document in the Documents repository found under the Application menu.  Probably in the default language folder, since this is likely not language specific.

 

Fourth, make sure the XML is valid when you save it, and right now, what you pasted is not.  Maybe you pasted only a portion of it, so that's ok, but be sure it's valid XML first by using a site like: https://codebeautify.org/xmlvalidator

 

Fifth, use a Document variable in your script to reference the XML file in UCCX like this: DOC[myfilename.xml]

 

Sixth, use the Create XML Document step to convert the above file reference to an XML object, which is needed for the next step.

 

Seventh, use the Get XML Document Data step to read data from your above XML object, using an XPATH expression to describe what data you need from the XML Object, storing the output in a String variable.  Even numbers are returned as Strings.

 

Eighth, validate that you got the output you needed, which could be a simple null check, or a length check.

 

Ninth, decide if a Call Redirect or Call Consult Transfer is more appropriate for your needs, to send the caller to the on call phone number.

 

Let me know which steps you have a handle on, and which you need help with.

I am needing help with formating the xpath.  I am not sure how to get the contact number from the section that today's date falls in between (or on).  Each department has several sections with different start and end times.

 

I am able to get this far. And using the xpather tool I am getting several results.

//OnCall/Department[@Name='Telecom']/PrimaryContact/PrimaryContactMobileNumber

I have progessed a little, but I  am still unable to get only the oncall number for between the active dates.

 

//OnCall/Department[@Name='Telecom']['StartTime<=[%CurrentDateTime%]' and 'EndTime>=[%CurrentDateTime%]']/PrimaryContact/PrimaryContactMobileNumber

I haven't had time to look at this too closely, but my main concern is the ability to ask XPATH to compare dates for us. We might need to off load that work to UCCX. Not sure yet though, I will need to do some testing.

I removed all of the dashes from the xml file due to another site saying that xpath can't compare dates and suggesting to remove the dashes and compare that way.    I am now able to pull the on call number for the needed dates on xpather, but when I try to pull the data in the script it is returning null. 

 

xpath

//OnCall/Department[@Name='Telecom' and StartTime<= '20190201' and EndTime>='20190201']/PrimaryContact/PrimaryContactMobileNumber

 

This image is a little busy, but it shows that the Xpather XPATH expression and the UCCX editor return the same value.  Now, mine is slightly different than yours, so don't take it as the answer, but do use it as a guide.  Did you also remove the time from the data as well?  I don't see how the comparison of StartTime<='20190201' would work, with the time in there, so I assumed you removed it, and therefore, so did I.

 

xpather.png

I didn't pull out the time and xpather was still pulling up the correct data.  I just tried pulling out the time in the file the script is referencing and it worked.  Thank you for your patience and help.  Your solutions to other people's questions has helped me a ton in the past .

Us Anthony's have to stick together!!