我有一个SharePoint列表,我正在使用客户端对象模型添加新的ListItems.添加ListItems不是问题,效果很好.
现在我想添加附件.
我以下列方式使用SaveBinaryDirect:
File.SaveBinaryDirect(clientCtx, url.AbsolutePath + "/Attachments/31/" + fileName, inputStream, true);
Run Code Online (Sandbox Code Playgroud)
只要我尝试添加附件的项目已经具有通过SharePoint网站添加的附件而不使用客户端对象模型,它就没有任何问题.
当我尝试将附件添加到没有任何附件的项目时,我会收到以下错误(两者都发生但没有相同的文件 - 但这两个消息始终显示):
The remote server returned an error: (409) Conflict
The remote server returned an error: (404) Not Found
我想我可能需要先为这个项目创建附件文件夹.当我尝试以下代码时:
clientCtx.Load(ticketList.RootFolder.Folders);
clientCtx.ExecuteQuery();
clientCtx.Load(ticketList.RootFolder.Folders[1]); // 1 -> Attachment folder
clientCtx.Load(ticketList.RootFolder.Folders[1].Folders);
clientCtx.ExecuteQuery();
Folder folder = ticketList.RootFolder.Folders[1].Folders.Add("33");
clientCtx.ExecuteQuery();
Run Code Online (Sandbox Code Playgroud)
我收到一条错误消息:
Cannot create folder "Lists/Ticket System/Attachment/33"
我拥有SharePoint站点/列表的完全管理员权限.
我有什么想法可能做错了吗?
谢谢,Thorben
我是Elasticsearch的新手,我在这里阅读https://www.elastic.co/guide/en/elasticsearch/plugins/master/mapper-attachments.html,在elasticsearch 5.0.0中不推荐使用mapper-attachments插件.
我现在尝试使用新的ingest-attachment插件索引pdf文件并上传附件.
到目前为止我尝试过的是
curl -H 'Content-Type: application/pdf' -XPOST localhost:9200/test/1 -d @/cygdrive/c/test/test.pdf
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to parse"}],"type":"mapper_parsing_exception","reason":"failed to parse","caused_by":{"type":"not_x_content_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"}},"status":400}
Run Code Online (Sandbox Code Playgroud)
我希望pdf文件将被编入索引并上传.我究竟做错了什么?
我还测试了Elasticsearch 2.3.3,但mapper-attachments插件对此版本无效,我不想使用任何旧版本的Elasticsearch.
我正在尝试在java中编写一个宁静的Web服务,它将采用一些字符串参数和一个二进制文件(pdf)参数.
我理解如何做字符串,但我已经挂断了二进制文件.任何想法/例子?
这是我到目前为止所拥有的
@GET
@ConsumeMime("multipart/form-data")
@ProduceMime("text/plain")
@Path("submit/{client_id}/{doc_id}/{html}/{password}")
public Response submit(@PathParam("client_id") String clientID,
@PathParam("doc_id") String docID,
@PathParam("html") String html,
@PathParam("password") String password,
@PathParam("pdf") File pdf) {
return Response.ok("true").build();
}
Run Code Online (Sandbox Code Playgroud)
由于我发布了这个已删除答案的链接,所以这是我的实现.
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.TEXT_PLAIN)
@Path("submit")
public Response submit(@FormDataParam("clientID") String clientID,
@FormDataParam("html") String html,
@FormDataParam("pdf") InputStream pdfStream) {
try {
byte[] pdfByteArray = DocUtils.convertInputStreamToByteArrary(pdfStream);
} catch (Exception ex) {
return Response.status(600).entity(ex.getMessage()).build();
}
}
...
public static byte[] convertInputStreamToByteArrary(InputStream in) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
final int BUF_SIZE = 1024;
byte[] …Run Code Online (Sandbox Code Playgroud) 我需要通过Ruby发送附件附件的电子邮件.
一直在寻找,但没有找到任何简单的脚本示例来做到这一点.
我发现最近的是ActionMailer,但似乎需要运行一堆其他脚本.(注意:我没有使用Ruby on Rails)
我编写了一个PowerShell脚本来创建一个电子邮件,但我似乎无法附加文件.该文件确实存在,PowerShell可以打开它,任何人都可以告诉我我做错了什么?
$ol = New-Object -comObject Outlook.Application
$message = $ol.CreateItem(0)
$message.Recipients.Add("Deployment")
$message.Subject = "Website deployment"
$message.Body = "See attached file for the updates made to the website`r`n`r`nWarm Regards`r`nLuke"
# Attach a file this doesn't work
$file = "K:\Deploy-log.csv"
$attachment = new-object System.Net.Mail.Attachment $file
$message.Attachments.Add($attachment)
Run Code Online (Sandbox Code Playgroud) 我发送文件作为附件:
// Create the file attachment for this e-mail message.
Attachment data = new Attachment(filePath, MediaTypeNames.Application.Octet);
// Add time stamp information for the file.
ContentDisposition disposition = data.ContentDisposition;
disposition.CreationDate = System.IO.File.GetCreationTime(filePath);
disposition.ModificationDate = System.IO.File.GetLastWriteTime(filePath);
disposition.ReadDate = System.IO.File.GetLastAccessTime(filePath);
// Add the file attachment to this e-mail message.
message.Attachments.Add(data);
Run Code Online (Sandbox Code Playgroud)
然后我想将文件移动到另一个文件夹,但是当我尝试这样做时
try
{
//File.Open(oldFullPath, FileMode.Open, FileAccess.ReadWrite,FileShare.ReadWrite);
File.Move(oldFullPath, newFullPath);
}
catch (Exception ex)
{
}
Run Code Online (Sandbox Code Playgroud)
它抛出了一个异常,即该文件已在另一个进程中使用.如何解锁此文件以便将其移动到此位置?
我的代码在附件中循环发送多封电子邮件,
问题是最后(以前所有)电子邮件的附件被附加到下一封电子邮件.
恩.假设3个电子邮件在数据库中,每个电子邮件中有1个附件(a1.pdf,a2.pdf,a3.pdf),然后它会发送带有附件的电子邮件
电子邮件1:
附件:a1.pdf
电子邮件2:
附件:a1.pdf,a2.pdf
电子邮件3:
附件:a1.pdf,a2.pdf,a3.pdf
我正在使用codeigniter框架.
我的代码是(这个代码在循环中调用)
...
$这 - >的电子邮件 - >受试者(本期特价货品$>受试者);
$this->email->message($message);
$attachments='';
if(strlen($item->attachment) > 5)
{
$attachments = explode(',', $item->attachment);
foreach($attachments as $attachment)
{
if(strlen($attachment)>5)
$this->email->attach(FCPATH . 'attachments/' . $attachment);
}
}
$this->email->send();
Run Code Online (Sandbox Code Playgroud)
...
我有一组图像,我想使用ffmpeg转换为视频.以下命令完全正常:
ffmpeg -y -i frames/%06d.png -c:v huffyuv -pix_fmt rgb24 testout.mkv
Run Code Online (Sandbox Code Playgroud)
我在二进制文件中有一些元数据,我想附加视频.我尝试了以下操作,但它给了我一个错误:
ffmpeg -y -i frames/%06d.png -c:v huffyuv -pix_fmt rgb24 -attach mybinaryfile -metadata:s:2 mimetype=application/octet-stream testout.mkv
Run Code Online (Sandbox Code Playgroud)
这是错误:
[matroska @ 0x656460] Codec for stream 1 does not use global headers but container format requires global headers
[matroska @ 0x656460] Attachment stream 1 has no mimetype tag and it cannot be deduced from the codec id.
Output #0, matroska, to 'testout.mkv':
Metadata:
encoder : Lavf56.33.101
Stream #0:0: Video: huffyuv (HFYU / 0x55594648), rgb24, 640x640, …Run Code Online (Sandbox Code Playgroud) 在Javascript中使用Gmail API发送带有HTML正文和~100KB PDF附件的邮件时,附件会正确显示在发件人的Gmail已发送文件夹中的邮件中,但不会显示在收件人的邮件中.
API调用是POST:
https://www.googleapis.com/upload/gmail/v1/users/me/messages/send?uploadType=media
Run Code Online (Sandbox Code Playgroud)
发送给API的请求正文是:
{
"headers": {
"Authorization": "Bearer authToken-removedForThisPost"
},
"method": "POST",
"contentType": "message/rfc822",
"contentLength": 134044,
"payload": "exampleBelow",
"muteHttpExceptions": true
}
Run Code Online (Sandbox Code Playgroud)
这是有效载荷的样子:
MIME-Version: 1.0
To: =?utf-8?B?TWlrZSBD?=<recipient@test.com>
CC: =?utf-8?B?TWlrZSBD?=<secondrecipient@gmail.com>
BCC: =?utf-8?B??=<bccrecipient@test.com>
From: =?utf-8?B?TWlrZSBxWXsd2lr?=<sender@test.com>
Subject: =?utf-8?B?subjectLine-removedForThisPost?=
Content-Type: multipart/alternative; boundary=__boundary__
--__boundary__
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: base64
base64EncodedStringHere-removedForThisPost
--__boundary__
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: base64
base64EncodedStringHere-removedForThisPost
--__boundary__
Content-Type: application/pdf; name="File Name.pdf"
Content-Disposition: attachment; filename="File Name.pdf"
Content-Transfer-Encoding: base64
base64EncodedStringHere-removedForThisPost
--__boundary__--
Run Code Online (Sandbox Code Playgroud)
注意:Gmail API上传附件文档指出,上传简单附件(5MB以下)时Content-Length需要.我做了它,以便我的代码生成PDF附件的总字节数的整数值.但是,我注意到它Content-Length没有包含在有效载荷中.
我尝试将multipart/alternative邮件的内容类型更改为 …
默认情况下,保存到内部存储的文件对应用程序是私有的,而其他应用程序无法访问它们(用户也无法访问).
我能够在DDMS中看到文件"/ data/data/package_name/files/in file explore,但是当我在电子邮件中使用imageUri附加上述文件URI时,我看到附件是0kb.我使用了Android的默认电子邮件API.
任何人都可以建议我,如何在应用程序私有的电子邮件中附加文件?
虽然我能成功地将文件保存在SD卡中并从SD卡附加文件,但这很好用.
但是,如果SD卡不可用并将文件保存到内部存储器,那么我如何将它们附加到电子邮件中.
String FILENAME = "hello_file.txt";
String string = "hello world!";FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.close();
File imageFile = getFileStreamPath(FILENAME );
Uri imageUri = Uri.fromFile(imageFile);
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("*/*");
emailIntent.putExtra(android.content.Intent.EXTRA_STREAM,imageUri);
this.startActivityForResult(Intent.createChooser(emailIntent, "Send mail..."),SUB_ACTIVITY);
Run Code Online (Sandbox Code Playgroud) attachment ×10
email ×5
c# ×2
android ×1
client ×1
ffmpeg ×1
gmail ×1
gmail-api ×1
java ×1
listitem ×1
locked-files ×1
pdf ×1
php ×1
plugins ×1
powershell ×1
rest ×1
ruby ×1
web-services ×1