简体   繁体   English

访问被拒绝。 来自HRESULT的异常:Windows Phone 8.1中的0x80070005

[英]Access is denied. Exception from HRESULT: 0x80070005 in Windows Phone 8.1

I am developing Windows Phone 8.1 Silverlight app, 我正在开发Windows Phone 8.1 Silverlight应用程序,

I am trying to Upload document from my SD card but getting this error. 我正在尝试从我的SD卡上传文档,但收到此错误。

Access is denied. Exception from HRESULT: 0x80070005
System.UnauthorizedAccessException

I have also added Capability "ID_CAP_REMOVABLE_STORAGE" in WMAppManifest file. 我还在WMAppManifest文件中添加了功能“ID_CAP_REMOVABLE_STORAGE”。 But didn't work. 但没有奏效。

See my code below: 请参阅下面的代码:

private async void UploadDocument()
{
  StorageFolder externalDevices = KnownFolders.RemovableDevices;

  StorageFolder sdCard = (await externalDevices.GetFoldersAsync()).FirstOrDefault();

  if (sdCard != null)
  {
      //An SD card is present and the sdCard variable now contains a reference to it
  }

  else
  {
      // No SD card is present.
  }
}

WP8.1 has also new manifest file - Package.appxmanifest - ensure that you have also added capability there - Location . WP8.1还有新的清单文件 - Package.appxmanifest - 确保你还在那里添加了功能 - 位置 Also you will have to add file type association as it's Silverlight . 此外,您还必须添加文件类型关联,因为它是Silverlight

Though (I don't know why) you will have to add this the first time from code - right click on Package.appxmanifest file -> View code and add for example like this in application/Extensions section: 虽然(我不知道为什么)你必须在代码中第一次添加它 - 右键单击Package.appxmanifest文件 - > 查看代码并在application / Extensions部分添加例如:

<Extension Category="windows.fileTypeAssociation">
  <FileTypeAssociation Name="text">
    <DisplayName>Text file</DisplayName>
    <SupportedFileTypes>
      <FileType ContentType="text/file">.txt</FileType>
    </SupportedFileTypes>
  </FileTypeAssociation>
</Extension>

Once you add it and save, you be able to add/edit FileTypeAssociations via graphic UI. 添加并保存后,您可以通过图形用户界面添加/编辑FileTypeAssociations

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 移至Windows Phone 8.1中的表单会引发“访问被拒绝。 (来自HRESULT的异常:0x80070005(E_ACCESSDENIED))” - Moving to forms in Windows Phone 8.1 throws “Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))” 获取“访问被拒绝。 (在HR8ULT中出现异常:0x80070005(E_ACCESSDENIED))在Windows 8 App中,在DispatchTimer中使用Message对话框时? - Getting “Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))” in Windows 8 App when using Message dialog in DispatchTimer? 访问被拒绝。 (来自 HRESULT 的异常:0x80070005 (E_ACCESSDENIED))删除活动目录帐户 - Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) deleting active directory account 访问被拒绝。 (HRESULT异常:0x80070005(E_ACCESSDENIED))添加Active Directory帐户 - Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) Adding Active Directory Account 访问被拒绝。 (HRESULT异常:0x80070005(E_ACCESSDENIED) - Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED) 访问被拒绝。 (来自 HRESULT 的异常:0x80070005 (E_ACCESSDENIED))'防火墙 INetFwPolicy2 - Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))' firewall INetFwPolicy2 C#-访问被拒绝。 (来自HRESULT的异常:0x80070005(E_ACCESSDENIED)) - C# - Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) System.UnauthorizedAccessException: '访问被拒绝。 (来自 HRESULT 的异常:0x80070005 (E_ACCESSDENIED))' - System.UnauthorizedAccessException: 'Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))' Checkbox1.GetAttribute(“ checked”)发生错误:访问被拒绝。 (来自HRESULT的异常:0x80070005(E_ACCESSDENIED)); - Checkbox1.GetAttribute(“checked”) occur an Error: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)); 访问被拒绝。 (HRESULT 异常:0x80070005 (E_ACCESSDENIED))尝试读取 Airpod pro 电池时 - Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) when trying to read battery of Airpod pro
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM