小编Muh*_*aja的帖子

解决文件路径过长异常的最佳方法

我创建了一个应用程序,下载SP站点中的所有文档库,但有一次它给了我这个错误(我试着看谷歌但无法找到任何东西,现在如果有人知道解决这个问题的任何技巧,请回复否则谢谢看着它)

System.IO.PathTooLongException:指定的路径,文件名或两者都太长.完全限定的文件名必须少于260个字符,目录名必须少于248个字符.在System.IO.Path.NormalizePathFast(字符串路径,布尔fullCheck)在System.IO.Path.GetFullPathInternal(字符串路径)在System.IO.FileStream.Init(字符串路径,的FileMode模式,FileAccess的访问,权限的Int32,布尔useRights ,文件共享份额,缓冲区大小的Int32,FileOptions选项,SECURITY_ATTRIBUTES secAttrs,字符串MSGPATH,布尔bFromProxy)在System.IO.FileStream..ctor(在系统字符串路径,的FileMode模式,FileAccess的访问,文件共享份额,缓冲区大小的Int32,FileOptions选项). IO.File.Create(String path)

它达到字符串的限制,代码如下,

#region Downloading Schemes

    private void btnDownload_Click(object sender, EventArgs e)
    {
        TreeNode currentNode = tvWebs.SelectedNode;
        SPObjectData objectData = (SPObjectData)currentNode.Tag;
        try
        {
            CreateLoggingFile();
            using (SPWeb TopLevelWeb = objectData.Web)
            {
                if(TopLevelWeb != null)
                    dwnEachWeb(TopLevelWeb, TopLevelWeb.Title, tbDirectory.Text);
            }
        }
        catch (Exception ex)
        {
            Trace.WriteLine(string.Format("Exception caught when tried to pass TopLevelWeb:{1}, Title = {2}, object data to (dwnEachWeb_method), Exception: {0}", ex.ToString(), objectData.Web, objectData.Title));
        }
        finally
        {
            CloseLoggingFile();
        }
    }

    private void dwnEachWeb(SPWeb TopLevelWeb, string FolderName, string CurrentDirectory)
    { …
Run Code Online (Sandbox Code Playgroud)

.net c# string sharepoint file

92
推荐指数
5
解决办法
19万
查看次数

MemberwiseClone()的方法是什么?

我对下面的代码感到困惑,

Developer devCopy = (Developer)dev.Clone();
Run Code Online (Sandbox Code Playgroud)

Developer类的克隆方法只是创建一个Employee克隆,然后是开发人员如何获得另一个开发人员克隆.

public abstract class Employee
{
    public abstract Employee Clone();

    public string Name { get; set; }
    public string Role { get; set; }
}


public class Typist : Employee
{
    public int WordsPerMinute { get; set; }

    public override Employee Clone()
    {
        return (Employee)MemberwiseClone();
    }

    public override string ToString()
    {
        return string.Format("{0} - {1} - {2}wpm", Name, Role, WordsPerMinute);
    }
}


public class Developer : Employee
{
    public string PreferredLanguage { get; set; } …
Run Code Online (Sandbox Code Playgroud)

c# design-patterns prototype clone

48
推荐指数
3
解决办法
7万
查看次数

如何在eclipse中打开一个项目

我下载了一个LISTViewTutorial的zip文件,包含所有文件,但我不知道如何在eclipse中打开它,因为它只是打开文件,而不是整个项目....

我从这里下载了它

http://mfarhan133.wordpress.com/2010/10/14/list-view-tutorial-for-android/ 谢谢很多

eclipse android

10
推荐指数
1
解决办法
1万
查看次数

如何找到ADUser的密码到期日期或密码到期之前的剩余天数?

我有一个ADUsers列表,我想检查是否有任何用户的密码即将到期,但我找不到任何要检查的属性.

.net c# active-directory

7
推荐指数
1
解决办法
6779
查看次数

支持长路径的Directory.CreateDirectory(path)的替代方法

Directory.CreateDirectory()我想创建一个目录,该目录长于260个字符,只是想知道是否有替代方法,尽管文件名不是很长,但目录路径却是。

要么

如果有什么窍门,我可以CreateDirectory在此位置创建一个文件夹,而无需提供目录的完整路径。当我在文件夹等内创建文件夹时。必须有一些合法的方法来执行此操作。

我现在保存在隐藏标签中的字符串存在问题,因此不再是问题。

.net c#

5
推荐指数
1
解决办法
6521
查看次数

.NET参考(找不到方法)

我在这一行收到错误

return folder.SubFolders.Aggregate(count, (current, subfolder) =>
               GetFilesCount(subfolder, current));
Run Code Online (Sandbox Code Playgroud)

错误是

错误1'Microsoft.SharePoint.SPFolderCollection'不包含'Aggregate'的定义,也没有扩展方法'Aggregate'接受类型为'Microsoft.SharePoint.SPFolderCollection'的第一个参数'(您是否缺少using指令或装配参考?)

其余的代码是

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using Microsoft.SharePoint;
using System.Windows.Controls;
using System.IO;
using System.Collections;

 namespace WindowsFormsApplication1
 {
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                using (SPSite currentSite = new SPSite(txtSiteAddress.Text))
                {
                    SPWeb currentweb = currentSite.OpenWeb();
                    var webtree = new TreeViewItem();
                    webtree.Header = currentweb.Title;
                    webtree.Tag = …
Run Code Online (Sandbox Code Playgroud)

.net c# sharepoint

1
推荐指数
1
解决办法
932
查看次数

将XMLHTTPRequest转换为$ ajax

我使用以下代码在小工具中获取Google:

<html>
<head>
<title>Browser</title>
</head>
<body onload= "getListCollection()" style="width:900px; height:900px;" >
<div id="listAttributes" style="width:400px; height:400px;" ></div>
<script>

function getListCollection() {
    var url = "https://www.google.co.uk"  
    xmlhttp = new XMLHttpRequest();
    xmlhttp.open('GET',url,true, 'user', 'password');
    xmlhttp.onreadystatechange = function()
    {
        if(xmlhttp.readyState == 4);
        {
            document.getElementById("listAttributes").innerHTML = xmlhttp.responseText
        }
    }
    xmlhttp.send(null);
}
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我想知道如何使用$ ajax做同样的事情?

我看了不同的例子,但我不知道他们将如何适应这种情况.或者,如果你可以发布一些不错的$ ajax教程.

当我将其更改为此时,它不起作用:

<html>
<head>
<title>Browser</title>
</head>
<body onload= "getListCollection()" style="width:900px; height:900px;" >
<div id="listAttributes" style="width:400px; height:400px;" ></div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js">

$.ajax({
    url : 'https://www.google.co.uk',
    type : 'GET',
    success : …
Run Code Online (Sandbox Code Playgroud)

javascript xml jquery xmlhttprequest

-5
推荐指数
1
解决办法
2433
查看次数