If integrals of pullbacks of a form only depend on the boundary values, is it exact?

Let $N$ be a smooth manifold with boundary, and let $\omega \in \Omega^m(N)$.

Suppose that for every smooth $m$-dimensional manifold $M$ with boundary, and for every smooth maps $f_0,f_1:M \to N$ such that $f_0|_{\partial M}=f_1|_{\partial M}$, we have $\int_M f_0^* \omega=\int_M f_1^* \omega$.

Is it true $\omega$ is exact? Does anything change if we only assume $\int_M f_0^* \omega=\int_M f_1^* \omega$ for arbitrary maps $f$ from a fixed manifold $M$?

I am quite sure $\omega$ must be closed. The argument should be similar to the one given here.

Note that in dimension $1$, this is a classic result, and that the converse direction is immediate:

Let $f:M \to N$ be smooth. By assumption, $\omega=d\eta$ for some $\eta \in \Omega^{m-1}(N)$. Thus $$\int_{M}f^*\omega=\int_{M}f^*d\eta=\int_{M}df^*\eta=\int_{\partial M}f^*\eta$$ depends only on $f|_{\partial M}$.

• Right. I was thinking in my head about a more generalized situation... Thanks. – Asaf Shachar Feb 9 '18 at 6:48
• @AmitaiYuval: No one said that $\dim N = m$ as well. So the pullbacks are of course closed forms on $M$, but $\omega$ needn't be closed on $N$ if $\dim N > m$. – Ted Shifrin Feb 9 '18 at 19:10
• @TedShifrin Yeah, I put that comment before OP edited the question... Thanks. – Amitai Yuval Feb 9 '18 at 19:56

Suppose $N$ is closed and oriented and that we know that $\omega$ is closed. Then taking $M$ to be a closed manifold without boundary, $f_0$ an embedding and $f_1$ a constant map, it follows that $\int_Mf_0^*\omega=0$. So $\omega$ integrates to zero over every embedded submanifold.
But I think it then follows by Poincare duality that $[\omega]=0\in H^d(N)$, i.e. that $\omega$ is exact. You will need that every cohomology class is the poincare dual of (a real multiple of) an embedded submanifold.
I don't think you can infer much if you only take a fixed manifold $M$.