Today I came across the need to be able to upload documents to a SharePoint list. Not so bad, I have done this before, but this time I also need to populate some custom metadata about the document. After a lot of looking, searching and exceptions I finally found the answer and here it is.
Add References to Microsoft.SharePoint.Client Library
Define a form
The important part I always forget is the enctype=”multipart/form-data”.
1: <form id="formUpload" method="POST" enctype="multipart/form-data ">
2: <input type="file" id="fileUpload" name="fileUpload" runat="server"/>
3: <input type="submit" value="upload"
4: OnServerClick="btnUploadTheFile_Click" runat="server"/>
The btnUploadTheFile_Click Handler
1: private void UpLoadToSharePoint()
3: var fileName = Path.GetFileName(fileUpload.PostedFile.FileName);
4: var fileStream = new FileStream(fileUpload.PostedFile.FileName, FileMode.Open);
5: var byteStream = new byte[fileStream.Length];
6: fileStream.Read(byteStream, 0, byteStream.Length);
8: var serverRelativeUrl = "/MySite/MyDocumentLibrary/" + fileName;
10: var fileCreationInformation = new FileCreationInformation
12: Content = byteStream,
13: Overwrite = true,
14: Url = serverRelativeUrl
17: var file = _sharePointList.RootFolder.Files.Add(fileCreationInformation);
18: file.ListItemAllFields["Column 1"] = "Value 1";
19: file.ListItemAllFields["Column 2"] = "Value 2";
This simple example shows how easy it is to upload a file to a SharePoint document list and provide additional column information.
Last Friday I presented on Domain Events at the Northwest Arkansas Techfest and there was a lot of interest and good discussions. Thanks to everyone who attended the session. I have updated the nuget packages to the latest release and have created some initial documentation located here. From there you can find links to the project site (full source available) and wiki.
The source also includes an example application as well as the demo script for the demo I used in my presentation. The demo script is step by step instructions to re-create the demo from the presentation.
As I mentioned in the session this code is publicly available and I do accept feature and pull request, see the project wiki for how you can contribute.
How to Host a Community Leadership Town Hall
I was recently asked if I would be hosting a Community Leadership Town Hall in Tulsa again this year. I will not be attending so I thought I would share what is needed and how to host a Community Leadership Town Hall in case there are others that would be interested in doing so.
Things you need:
- Category Signs: Membership, Leadership, Speakers, Sponsors, Meetings, Other
- 4x4 or 3x3 Sticky Notes, enough for everyone to write topics, questions, etc.
- Pens, I usually have a bundle of about 20 pens
- Color Coding Labels, i.e. dots used for voting
Stick up the Category signs around the room. Be sure to allow enough room for people to walk around and look over each others shoulders. These areas get pretty crowded during the Topic\Question and Voting sections.
Get 4 chairs that you can setup in the center of the room. This is the fish bowl and is where the main discussions will happened once the topics are organized. This is also a good way to keep the discussion close to microphones if you plan on recording it.
Time: 5 Minutes
In this section of the event you want to welcome everyone and let them know how the night will go. You can also ask if any of them are familiar with Open Space Technology events. This is a variation of that formula. This event is going to be only as good as what the attendees put into it, stress that and let them know they have a critical part to play in making it a success.
Time: 10 Minutes
Let them know that you will give them 10 minutes to write down questions or topics they would like to discuss. They don’t have to lead the discussion, just have the need or knowledge to share. Tell them they will need to write down the Topic\Question\Idea on a sticky note and then stick it on the wall under the Category that if best fits into. The things you want on the sticky notes; The topic/question and who wrote it. This helps later when you ask them to go over it in more detail and to take a set in the fish bowl to start the discussion.
Time: 10 Minutest
During the voting each person should read over the sticky notes posted and if they feel strongly about a topic they can vote on it by putting one of their dots on it. Once time is up have everyone return to their sets.
Time: 5 Minutes
Now you need to look over each category and find like items. Those that are similar or have a common theme and group them together. Once you finish that make a tally of which sticky notes have the most votes, counting similar themes as a single item. Organize the sticky notes in order from largest number of votes to smallest. This is now your agenda for the rest of the event. You want to do this quickly since everyone else is sitting around waiting, help can make this go faster.
The Fish Bowl
The fish bowl is where the real discussion happens. This is also a great way to control the amount of time spent on each topic making sure that everyone topics get a chance to be covered. Remember the 4 chairs? Ask the person that wrote the sticky to take a seat. Explain the fish bowl, only those seated in a chair can comment and one chair must remain empty at all times. Simple rules but it can make for some confusion. This is much like Survivor, if someone new shows up (sits in the empty chair) someone must vote themselves off the island (leave their chair). A great way to wind the discussion down and keep it on time is to pull the empty chair away every 5 minutes. Remember one chair must remain empty, since the empty chair is gone, someone has to get up. Continue this until there is one person and one chair left. When they finish, they have to get up the discussion is over.
Reset the chairs and start the next topic.
This a great open format for experts and those interested in a topic to share information. The events I have hosted in Houston, Dallas, and Tulsa have not only been informative they have been a lot of fun. You can also get a sponsor to cover food if you want to offer a meal to you attendees. This is an attendee lead event and the more input you get from them the better the event is. You job for hosting a Community Leadership Town Hall is well to host. You are just there to get everyone else talking, and they will just give them the floor and see what happens.
This Friday, August 24, 2012 8:00 AM – 5:00 PM
I will be presenting two sessions at this years Northwest Arkansas Techfest. If you haven’t already head on over to http://nwatechfest.com and register. This year is looking like it will be even bigger than events in the past. Go out and support your local technology conference and help make this an awesome event.
Here is the information about the sessions I will be presenting.
0 to 60 With Highway.Data
In this session we will take an look at Highway.Data and how it makes it easy to get up and running with Entity Framework. Highway.Data is part of the Highway Framework being developed by Tim Rayburn and Devlin Liles. This framework pulls together all the best practices of their Entity Framework 4.1 Expert's Cookbook book into a framework that makes consuming data much easier. This session will cover the newly release version 2.0 of Highway.Data.
Track: Big and Small Data
Time: 1:00 PM
Domain Eventing, Using Domain Events to create more composable applications.
In this session I will present a strategy I have implemented for using events in the domain model to make applications more composable. Domain Events allow you define system events and then implement handlers that take action when those events occur.
Track: Advanced Development
Time: 2:00 PM
I’d love to have you stop my one of my sessions and give feedback on the content and direction. Each of my sessions is already or working toward creating a reusable library that will be made available via nuget. So, your input at this stage can influence future releases.
Several years ago I started a podcast with the goal of interviewing community leaders and sponsors help get the word out about best practices and how a community leader could connect with potential sponsors. I know sounds like a good idea, right? Well truth be told I found I don’t have the discipline or time to dedicate to create a quality show so after only a few shows they stopped. I have kept the site up in the hopes that I would be motivated to get back to it. But there have developments in my life over the last year that have pulled me further away from community. The User Group Radio domain is about to expire and I am going to let it.
So, as User Group Radio fades into the sunset a chapter is closed on my community involvement. Who knows what the future holds. I still believe that there is a need for community leaders to be able to share best practices with each other to ease the pain of onboarding new leaders but also have come to the reality that community leaders have precious little time to dedicate to these efforts.
Thanks to those who allowed me the privilege of interviewing you and I apologize to those who I interviewed that the show never was released.