none
How to get current *.aspx page in which folder and get this folderID RRS feed

  • 问题

  • I havd a require about how to get current *.aspx page in which folders and how to get this folderID. Is anynoe has any idea for it, and I am using C# to archive it.
    2014年6月9日 10:23

全部回复

  • hi

    Maybe use two methods get it

    1,use asp.net

          SPQuery myFolderQuery = new SPQuery();
                                       myFolderQuery.ViewAttributes = "Scope='RecursiveAll'";
                                       label3.Text = "luguo3";
                                       //获得文件信息
                                       myFolderQuery.Query = @"<Where>
                                                      <Eq>
                                                        <FieldRef Name='FSObjType'/>
                                                        <Value Type='Int'>1</Value>
                                                      </Eq>
                                                    </Where>
                                                    <OrderBy>
                                                        <FieldRef Name='DeptWeight' Ascending='true' />
                                                    </OrderBy>
                                                    ";
                                       SPListItemCollection myFolders = myList.GetItems(myFolderQuery);
    
                                       DataTable myFolder_DT = new DataTable("folderDT");
                                       myFolder_DT = myFolders.GetDataTable();
    
                                       myFolder_DT.Columns.Add("Hierarchy", Type.GetType("System.String"));
                                       myFolder_DT.Columns.Add("ItemId", Type.GetType("System.Guid"));
                                       DataRow[] myFolderTempRows;
                                       string myFolderTempUrl = "";

     

    2014年6月12日 23:55
  • Method 2

    use JQuery

       var currentUrl = location.href;

      url=siteUrl;
        //var DocName="/AIC/SingtelLaunchProcess";
        var DocName="AIC%20Documentation";
        var val;
        $.ajax({
            url: url + "/_api/web/GetFolderByServerRelativeUrl('" + DocName + "')/Files",
            method: "GET",
            headers: {
                "Accept": "application/json; odata=verbose"
            },
            success: function (data) {
                var results = data.d.results; 
                var ArrayName = [];
                $.each(results,function(result,val){
                    ArrayName.push(val.Name);
                }); 
                var GetVal=arrVal.split(",")[0];
                var _inExst=$.inArray(GetVal,ArrayName);   
                if(_inExst>=0){  
                    //得到此文件的URL拼接字符串
                    var UniqueIdstr=data.d.results[_inExst].UniqueId;
                    var docNameStr=data.d.results[_inExst].Name;
                    var  UrlStr1="https://avhk.sharepoint.com/AIC/_layouts/15/WopiFrame.aspx?sourcedoc={"+UniqueIdstr+"}&file="+docNameStr;
                    createListItem(arrVal+","+UrlStr1);
                  
                }
            },
            error: function (data) {
               
                failure(data);
            }  
        });

    2014年6月13日 0:00
  • ok if you have any query please feel free to let me know.

    2014年6月13日 0:01