Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RenderChromeControl();

            if (!IsPostBack)
            {
                //provision data needed for this demo
                var provisionner = new Provisionner();
                provisionner.ProvisionData(Context);

                //data to use later in javascript (set document from javascript)
                var spContext = SharePointContextProvider.Current.GetSharePointContext(Context);
                defaultDocumentUrl.Value  = provisionner.GetSampleDocumentUrl2(spContext);
                defaultDocumentPath.Value = provisionner.GetSampleDocumentPath2();
                DocList1Id.Value          = provisionner.ProvisionnedList1Id.ToString();
                DocList2Id.Value          = provisionner.ProvisionnedList2Id.ToString();


                //set default document in standard peoplepicker
                List <PickedDocument> documents = new List <PickedDocument>();

                //the sample is setting the url and (fake) id data manually. In a real situation you get this data from sharepoint.
                PickedDocument doc = new PickedDocument();
                doc.DocumentUrl  = provisionner.GetSampleDocumentUrl1(spContext);
                doc.DocumentPath = provisionner.GetSampleDocumentPath1();
                doc.ItemId       = "1";
                documents.Add(doc);

                DocumentPickerHelper.SetData(BasicDocumentPickerValue, documents);
            }
        }
Example #2
0
        //this method will get the selected values from the document picker
        protected void GetValuesButton_Click(object sender, EventArgs e)
        {
            var selectedDocuments = DocumentPickerHelper.GetData(BasicDocumentPickerValue);

            string output = "<b>Selected documents:</b><br>";

            foreach (var document in selectedDocuments)
            {
                output += "<b>Item:</b> " + document.ItemId + " <br> ";
                output += "<b>Path:</b> " + document.DocumentPath + " <br> ";
                output += "<b>Url:</b> " + document.DocumentUrl + " <br> ";
                output += "------------- <br> ";
            }

            OutputLabel.Text = output;
        }