문제

I Create Visual Web Part for SharePoint Calendar (New form). I have needs to retrieve clicked date in sharepoint calendar.

How to do this:

enter image description here

Thank you previusly!

도움이 되었습니까?

해결책

When we click “Add” in a date column in SharePoint Calendar, the default value of “Start Time” and “End Time” in the opened New Form will be the selected date.

enter image description here

To get the selected date, we can get the default “Start Time/End Time” and set the Title to its value using JavaScript in New Form.

Add the following script to the page:

<script src="http://code.jquery.com/jquery-1.11.3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
  setTimeout(function() {
    var date = $('[id$="DateTimeField_DateTimeFieldDate"]').val();
    $("input[title='Title']").val(date);
  }, 200);  
})
</script>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top