첨부파일
지원 중단되었습니다. 이 클래스는 지원 중단되었으며 새 스크립트에서 사용하면 안 됩니다.
Sites 첨부파일(예: 페이지에 첨부된 파일)
Attachment는 Blob이며, Blob 입력이 예상되는 곳이라면 어디에서나 사용할 수 있습니다.
var filesPage = SitesApp.getSite('example.com', 'mysite').getChildByName("files");
var attachments = filesPage.getAttachments();
// DocsList.createFile accepts a blob input. Since an Attachment is just a blob, we can
// just pass it directly to that method
var file = DocsList.createFile(attachments[0]);
getAttachmentType()
지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.
이 첨부파일의 유형 (HOSTED 또는 WEB)을 반환합니다.
var pages = SitesApp.getSite('example.com', 'mysite').getChildren();
var attachments = pages[0].getAttachments();
var attType = attachments[0].getAttachmentType();
// This will log "Hosted"
Logger.log(attType);
// Since this returns an AttachmentType and not a String, for the
// purposes of equivalence we want to either do this or cast the
// type to a String
if(attType == SitesService.AttachmentType.HOSTED) {
Logger.log("This is a match");
}
// The above is the same as
if(String(attType) == "Hosted") {
Logger.log("This is also a match");
}
리턴
AttachmentType
— 첨부파일 유형
승인
이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.
-
https://sites.google.com/feeds
getContentType()
지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.
이 첨부파일의 MIME 유형을 반환합니다. 웹 첨부파일에 실패했습니다.
var pages = SitesApp.getSite('example.com', 'mysite').getChildren();
var attachments = pages[0].getAttachments();
var contentType = attachments[0].getContentType();
리턴
String
: 첨부파일 MIME 유형
승인
이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.
-
https://sites.google.com/feeds
getDatePublished()
지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.
이 첨부파일이 처음 게시된 날짜를 반환합니다.
var pages = SitesApp.getSite('example.com', 'mysite').getChildren();
var attachments = pages[0].getAttachments();
var date = attachments[0].getDatePublished();
리턴
Date
: 최초 발행일
승인
이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.
-
https://sites.google.com/feeds
getLastUpdated()
지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.
이 첨부파일이 마지막으로 업데이트된 날짜를 반환합니다.
var pages = SitesApp.getSite('example.com', 'mysite').getChildren();
var attachments = pages[0].getAttachments();
var date = attachments[0].getLastUpdated();
리턴
Date
: 최종 업데이트 날짜
승인
이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.
-
https://sites.google.com/feeds
setContentType(contentType)
지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.
이 첨부파일의 MIME 유형을 설정합니다. 웹 첨부파일에 실패했습니다.
var pages = SitesApp.getSite('example.com', 'mysite').getChildren();
var attachments = pages[0].getAttachments();
attachments[0].setContentType("text/plain");
매개변수
이름 | 유형 | 설명 |
contentType | String | 새로운 MIME 유형 |
리턴
Attachment
: 연결을 위한 이 첨부파일입니다.
승인
이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.
-
https://sites.google.com/feeds
setDescription(description)
지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.
첨부파일의 설명을 설정합니다.
var pages = SitesApp.getSite('example.com', 'mysite').getChildren();
var attachments = pages[0].getAttachments();
// This is an example of chaining in action
attachments[0].setTitle("New Title")
.setDescription("New Description");
매개변수
이름 | 유형 | 설명 |
description | String | 새 설명 |
리턴
Attachment
: 연결을 위한 이 첨부파일입니다.
승인
이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.
-
https://sites.google.com/feeds
setFrom(blob)
지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.
이 연결의 실제 데이터를 설정합니다. 웹 첨부파일에 실패했습니다.
var pages = SitesApp.getSite('demositeappsscript').getChildren();
var attachments = pages[0].getAttachments();
// This snippet demonstrates how to create a new text blob and attach it
// to the page
var blob = Utilities.newBlob("This data is now the attachment content");
// We must set a filename since we created the blob from String data
// instead of something like a URL source
blob.setName("attachment.txt");
attachments[0].setTitle("New Title")
.setDescription("New Description")
.setContentType("text/plain")
.setFrom(blob);
매개변수
리턴
Attachment
: 연결을 위한 이 첨부파일입니다.
승인
이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.
-
https://sites.google.com/feeds
setParent(parent)
지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.
첨부파일의 상위 페이지를 설정합니다.
var pages = SitesApp.getSite('example.com', 'mysite').getChildren();
var attachments = pages[0].getAttachments();
// Sets the parent page to be the next sibling
attachments[0].setParent(pages[1]);
매개변수
리턴
Attachment
: 연결을 위한 이 첨부파일입니다.
승인
이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.
-
https://sites.google.com/feeds
setTitle(title)
지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.
첨부파일의 제목을 설정합니다.
var pages = SitesApp.getSite('example.com', 'mysite').getChildren();
var attachments = pages[0].getAttachments();
// This is an example of chaining in action
attachments[0].setTitle("New Title")
.setDescription("New Description");
매개변수
리턴
Attachment
: 연결을 위한 이 첨부파일입니다.
승인
이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.
-
https://sites.google.com/feeds
setUrl(url)
지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.
첨부파일의 다운로드 URL을 설정합니다. 웹 첨부파일에만 유효합니다.
var pages = SitesApp.getSite('demositeappsscript').getChildren();
var attachments = pages[0].getAttachments();
attachments[0].setTitle("New Web Attachment")
.setDescription("New Description")
.setUrl("http://example.com/files/your_file.txt");
매개변수
리턴
Attachment
: 연결을 위한 이 첨부파일입니다.
승인
이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.
-
https://sites.google.com/feeds