Example #1
0
        public void ExportFile(ControlWrapper wrapper, string folder)
        {
            SPListItem item = List.GetItemByUniqueId(wrapper.UniqueID);

            if (item.FileSystemObjectType == SPFileSystemObjectType.File)
            {
                string destFile = folder + "\\" + item.File.Name;
                Stream input    = item.File.OpenBinaryStream();
                ExportStream(destFile, input);
            }
        }
Example #2
0
        private void DocumentLibrarySelected(object sender, EventArgs e)
        {
            List = (SPList)lbDocLib.SelectedItem;

            // as the ToString-methode of the SPListItem does not return the name we have made up a wrapper class
            // to avoid iterating the collection later on and at the same time are able to bind it to the listbox
            // and get a meaningful display name

            lbItems.Items.Clear();

            foreach (SPListItem item in List.Items)
            {
                var cw = new ControlWrapper(item.Name, item.UniqueId);
                lbItems.Items.Add(cw);
            }
        }