Sharepoint使用最新的PnP Js托管Addin [英] Sharepoint hosted Addin with latest PnP Js

查看:229
本文介绍了Sharepoint使用最新的PnP Js托管Addin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我是pnp js的新手。我创建了SharePoint 2013托管插件,我想使用PnP js来执行SharePoint操作。这只是为了学习而我们用普通的jquery做不了什么。



一旦我编译我得到错误"找不到名称地图"。这是打字稿界面,但我不知道为什么我得到这个构建错误为什​​么visual studio无法编译



解决方案信息



我正在使用visual studio 2015.从项目中我创建了sharepoint 2013托管插件。之后我编辑了csproj文件并进行了以下输入以编译打字稿。


 < PropertyGroup>

  &NBSP; < TypeScriptSourceMap> true< / TypeScriptSourceMap>

  < / PropertyGroup>

  < Import Project =" $(MSBuildExtensionsPath32)\ Microsoft &\\VisualStudio \ v $(VisualStudioVersion)\ TypeScript \ MicroSoftScript.targets" />
$


我安装了npm和typescript编译器。



我从导航到解决方案命令提示符并已安装 



npm install @ pnp / logging @ pnp / common @ pnp / odata @ pnp / sp --save



我无法添加我的解决方案结构,因为我的帐户未经过验证,但是我在下载所有文件后所做的工作我在项目中包含节点模块,以便我可以将其用于参考






我将使用捆绑包捆绑所有pnp文件并在aspx页面中使用它 所以这不是问题。正如我之前所说,我无法编译。任何帮助都可以被欣赏。我甚至创建了tsconfig文件并填充了与pnp项目中存在的相同选项
但是它不起作用。$


打字稿版本为2.8.4

解决方案


如果你想开发SharePoint托管加载项解决方案并使用pnp js库,您可以直接使用pnp.js库。


你可以检查以下示例项目。


https://github.com/SharePoint/PnP/tree/master/Samples/SharePoint.pnp-js-core


如果您熟悉打字稿,我建议开发SPFx解决方案,其中一个是下一个SharePoint在线或SharePoint 2016的SharePoint开发中的演变。


https://docs.microsoft.com/en-us/sharepoint/dev/spfx/sharepoint-framework-overview


在SPFx中使用PNP js。


< span style ="color:#1F497D"> https://github.com/SharePoint/sp-dev-docs/blob/master/docs/spfx/web-parts/guidance/use-sp-pnp- js-with-spfx-web-parts.md


最好的问候,



Hi

I am new to pnp js. I have created SharePoint 2013 hosted addin and I wanted to use PnP js to perform SharePoint operations.This is just for learning and nothing which we cannot do using normal jquery.

As soon as I compile I am getting error "Cannot find Name Map".This is typescript interface but I don't know why I am getting this build error Why visual studio is not able to compile

Solution information

I am using visual studio 2015.From the project I created sharepoint 2013 hosted addin. After that I edited csproj file and made following entry for compiling typescript

 <PropertyGroup>
    <TypeScriptSourceMap>true</TypeScriptSourceMap>
  </PropertyGroup>
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" />

I have npm and typescript compiler installed.

I navigated to the solution from the command prompt and installed 

npm install @pnp/logging @pnp/common @pnp/odata @pnp/sp --save

I am not able to add my solution structure because my account is not verified but what I did once all the files were downloaded I includes node module in the project so that I can use it for refrence



I will be using bundler to bundle all pnp files and use it in aspx page  so that is not an issue.As I told before I am not able to compile.Any help can be appreciated.I even created tsconfig file and populated with the same options as present in pnp projects but it didn't work.

Typescript version is 2.8.4

解决方案

Hi,

If you want to develop SharePoint hosted add-in solution and use pnp js library, you could use pnp.js library directly.

You could check below sample project.

https://github.com/SharePoint/PnP/tree/master/Samples/SharePoint.pnp-js-core

If you’re familiar with typescript, I would suggest develop SPFx solution which one is the next evolution in SharePoint development for SharePoint online or SharePoint 2016.

https://docs.microsoft.com/en-us/sharepoint/dev/spfx/sharepoint-framework-overview

Use PNP js in SPFx.

https://github.com/SharePoint/sp-dev-docs/blob/master/docs/spfx/web-parts/guidance/use-sp-pnp-js-with-spfx-web-parts.md

Best Regards,

Lee


这篇关于Sharepoint使用最新的PnP Js托管Addin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆