SharePoint Development from a Documentation Perspective
Here's something I meant to mention a while back: did you know that when you set a shape's action setting to launch a program, you can pass command line switches to that program?
This is something I stumbled across, and there doesn't seem to be any mention of it in the PowerPoint 2003 VBA Reference, so until the next update I'm posting the information here.
You can set PowerPoint to perform certain actions, including starting other programs, based on user interaction with a given shape. You do this by specifying a shape's action settings. Each shape can have two actions:
· One PowerPoint performs when the user clicks the shape.
· One PowerPoint performs when the user moves the mouse over the shape.
If you specify that PowerPoint should launch another application as one of a shape's action settings, you can also include any command line switches you want PowerPoint to pass to the target application.
Take a look at the code below. It assigns an action setting to the selected shape. The code selects the action PowerPoint performs when the shape is clicked, and sets two of that action's properties. The Action property specifies which action to perform; in this case, run a program. The Run property represents the program name, as well as any command line switches. In this example, we're passing the "/sidenote" command. During a presentation, when the user clicks on the shape, PowerPoint launches OneNote as a new side note.
With ActiveWindow.Selection.ShapeRange(1) _
.Action = ppActionRunProgram
.Run = "onenote.exe /sidenote"
(Wondering what other command line switches are available for OneNote? Oh look, I just happened to write an article about that very subject. How's that for cross-promotion?)
For the code-adverse of you out there, you can also do this through the user interface:
· Right-click the shape, and select Action Settings.
· On the Mouse Click or Mouse Over tab, select the Run program button.
· Enter the application name and command line switches in the text box below the Run program radio button.
Now all I have to do is update the PowerPoint VBA Reference...
My latest article on programming Publisher, Using Tags to Store Custom Information in Publisher 2003 and Publisher 2002, has just been published on MSDN. As the name states, the article talks about using the Tags collection of the Document, Page, and Shape objects in Publisher to store information, such as custom variables or state information not normally persisted in a Publisher file. You can use the Tags collection to persist a wide range of custom information within your publication, at the publication, page, or shape level. An interesting aspect of the Tags collection is one of the rare pieces of the Publisher object model that doesn't have a counterpart in the application's user interface.
If you've been reading my Publisher blog entries, you got a preview of the information in the article here, here, and here. But this article builds on that material and is worth a look even if you've read those entries.
I'm pretty happy with how this one turned out, especially the in-depth examples using catalog merge. I knew that when you perform a catalog merge, all the shapes in the catalog merge area are copied for each record. What I found out was, this includes any tags you've assigned to those shapes. Which lets you do some very interesting things, like embedding merge data source information within the shapes of the finished merge publication.
Go take a look.
Read part one here.
Next, we need to create custom animation that controls the order in which PowerPoint displays the shapes on the slide.
1. From the Slide Show menu, click Custom Animation.
2. Select the shape that displays the second-highest time (in our case, the shape displaying 0:50). In the Custom Animation task pane, click Add Effect, select Entrance, and then click on Appear.
3. The animation should now be listed in the animation list in the task pane.
4. Select the animation, and in the Start drop-down, select After Previous.
5. Click on the drop-down arrow next to the animation name, and then click Timing. In the animation dialog box, on the Timing tab, for Delay enter 10.
Repeat this for each shape, in descending order of the time each shape displays. So now you've got the shapes appearing at 10 seconds intervals, in the order of most time displayed (1:00) to least time (0:00). Note that you don't assign an animation to the first shape, because you want that shape to be visible as soon as PowerPoint displays the slide.
Now stack all the shapes on top of each other. That way, as each shape appears, it covers the previous shape. Because all the shapes appear the same, except for the time displayed on each, during a slide show they'll appear as a single shape counting down the seconds left on the time.
So our timer counts down the seconds correctly, but we also want to move to the next slide when the timer is done. For this, we'll use a slide transition, just as Geetesh does in his timer. We'll set the slide transition to occur one second after the timer finishes its count.
1. On the Slide Show menu, click Slide Transition.
2. In the Slide Transition task pane, select the type of transition you want.
3. Under Advance slide, check Automatically after and enter '01:10' in the text box. Make sure On mouse click is not checked.
We're done. When PowerPoint displays the slide, the animation sequence starts, displaying each shape at ten second intervals. At the same time, the slide transition is counting down. PowerPoint displays the final counter shape (0:00) one second before it executes the transition to the next slide.
As you can see, if you wanted a longer timer, say a five or ten minutes, or wanted to count off one-second intervals, creating the timer could get tedious real fast. The main advantage to this approach, as well as Geetesh's, is that it doesn't rely on anything other than PowerPoint's native functionality. Which means you can move the presentation to another machine and not have to worry about stuff like whether the security setting will allow code to run.
The disadvantages, of course, are that it's somewhat laborious to set up, and it's not very flexible. Because it relies on slide transition functionality, the timer has to start as soon as PowerPoint displays the slide. I couldn't think of a way to make the slide transition dependant on user interaction, which would have enabled me to let the user start the timer whenever they wanted. But for short timers where you don't want to (or can't) use VBA code or add-ins, it could come in handy.
As I mentioned in the last entry, the PowerPoint FAQ lists several timers available as VBA code or add-ins.
Speaking of time, it's probably past time I got back to my SharePoint research…
Yesterday, a co-worker asked a few of us in PowerPoint user assistance how to create a timer to use during a presentation break. The only stipulation was that the timer had to use PowerPoint's native capabilities: she wanted something she could give to other people without having to include instructions you'd need if the timer was an ActiveX control or relied on VBA code.
One of the other team members referred her to the Clocks and Timers section of the PowerPoint FAQ. Sure enough, there was an example of a timer using slide transitions, courtesy of Geetesh Bajaj.
And it got me thinking: Geetesh uses multiple slides to create a timer, but couldn't you create a timer using shape animation and a single slide? Creating a single-slide timer was primarily an aesthetic preference. The timer functions the same either way. I just preferred to have it on a single slide, so that when I'm in Normal or Slide Sorter view, the timer doesn't appear as a long series of slides. Having everything on a single slide also makes moving the timer, or pasting it into another presentation, easier.
(Creating it was also a nice distraction from all the SharePoint studying I've been doing. But that's neither here nor there.)
Anyway, here's how you can create a single-slide, codeless timer:
As an example, let's say you wanted to create a one-minute timer, with the visual display updated every ten seconds. First, add a new slide to the presentation. Then, create a shape that represents your timer, like so:
Next, copy and paste the shape back onto the same slide. Change the text so it displays ten seconds less. Repeat this process until you have shapes that count down to zero:
Now, let's make sure the z-order of the shapes is correct. The z-order basically refers to the order in which shapes are layered on the slide. We want the shapes stacked in order of increasing time, with the one-minute shape on the bottom. Think of it this way:
(Tip: Don’t actually stack the shapes on top of each other yet. That'll make the shapes to hard to work with.)
Here's how we can explicitly set the z-order:
Right-click the shape with the most time displaying (in our case, that's the one-minute shape), point to Order, and click Bring to Front. This moves that shape to the top of the z-order stack. Repeat this process with the shape displaying the next most time, and so on.
So now we have our shapes in the proper z-order. Next, we need to animate them so that PowerPoint displays them in the proper sequence, and at the proper intervals. Then we need to add a slide transition for when the timer hits zero. All of which we’ll do in the next entry.
For those of you who have been waiting for an actual copy of the OneNote schema, wait no more. MSDN has just republished the Office 2003: XML Reference Schemas download, and this time it includes OneNote 2003 SP1. The download includes a copy of the OneNote import schema, as well as the complete element, type, and attribute documentation we posted online awhile back. It also include a copy of my article detailing how to use the schema to import content into OneNote.
What more could you ask for?
Oh yeah, it includes the complete schemas and documentation for some applications called Excel, InfoPath, Project, Visio and Word as well.
So I moved into a new assignment last week. After spending the last two years writing about programming Publisher, PowerPoint, and OneNote (and occasionally Visio), it's only logical that I would move on to writing about something that really plays to my experience programming Windows client applications:
Windows SharePoint Services.
Seriously, I’m very excited about digging into the SharePoint products and exploring all the cool things you can do with them. But I have to say, I'm also more than a little intimidated. Not just by having to learn a new product, and the (several) technologies that product is built on and interacts with. Even more than that, I suspect I'll have to learn an entire new way of looking at programming. Having experience exclusively in programming Windows client applications, switching over to an application built on and employing database, server, and web technologies is a sea change. Like it or not, my world is about to get a lot more complicated.
Which probably puts me in the same camp with a lot of Office developers out there. So I've decided to blog about it. As I ramp up on the SharePoint products and underlying technologies, I'll try and chart my progress here, sharing what I'm learning, listing the resources I've found helpful, expounding on the deep insights I have that are probably blazingly obvious to anyone with a web programming background.
With any luck, detailing my learning curve with SharePoint technologies here can be of use to other Office developers out there making the same transition.
Off the top of my head, I'm pretty sure I'll need to learn about the following technologies to various degrees, before even getting to the SharePoint products:
· Windows Server 2003
· SQL Server 2000
· XML services
· .NET programming
Stay tuned. It should be an interesting ride.