我曾尝试为用户预先提供个人 OneDrive 网站但不起作用。我一直关注这些链接:
https://technet.microsoft.com/en-us/library/dn800987.aspx 和 http://www.thinkscape.com/Provision-OneDrive-For-Business-Personal-Sites/
我发现Request-SPOPersonalSite
已弃用并且不再有效,Connect-SPOService -Url $adminSiteUrl -Credential $credential
"Looking for personal site `$personalSiteUrl`"
Try
{
Get-SPOSite $personalSiteUrl | Out-Null
}
Catch
{
"Personal site not found. Creating it."
#Create-PersonalSite
Request-SPOPersonalSite -UserEmails @($email) -NoWait
}
是PowerShell的替代方案。
以下是我一直使用的脚本:
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Environment;
import android.util.Log;
public class VideoSaveSDCARD extends Activity{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ProgressBack PB = new ProgressBack();
PB.execute("");
}
private class ProgressBack extends AsyncTask<String,String,String> {
ProgressDialog PD;
@Override
protected void onPreExecute() {
PD= ProgressDialog.show(LoginPage.this,null, "Please Wait ...", true);
PD.setCancelable(true);
}
@Override
protected void doInBackground(String... arg0) {
downloadFile("http://beta-vidizmo.com/hilton.mp4","Sample.mp4");
}
protected void onPostExecute(Boolean result) {
PD.dismiss();
}
}
private void downloadFile(String fileURL, String fileName) {
try {
String rootDir = Environment.getExternalStorageDirectory()
+ File.separator + "Video";
File rootFile = new File(rootDir);
rootFile.mkdir();
URL url = new URL(fileURL);
HttpURLConnection c = (HttpURLConnection) url.openConnection();
c.setRequestMethod("GET");
c.setDoOutput(true);
c.connect();
//Updated Code.
File videoFile = new File(rootFile, fileName); // always maintain single Video File.
if(videoFile.exists())//check already exists
videoFile.delete();// then delete it.
FileOutputStream f = new FileOutputStream();
InputStream in = c.getInputStream();
byte[] buffer = new byte[1024];
int len1 = 0;
while ((len1 = in.read(buffer)) > 0) {
f.write(buffer, 0, len1);
}
f.close();
} catch (IOException e) {
Log.d("Error....", e.toString());
}
}
有没有人可以看到我做错了什么?